mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Minor refactoring & cleanup.
This commit is contained in:
parent
a622707608
commit
146f832919
@ -165,9 +165,9 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Permissions.getInstance().motd(player) && Config.getInstance().getMOTDEnabled()) {
|
||||
player.sendMessage(ChatColor.GOLD+"Server is running "+ChatColor.GREEN+plugin.getName()+" "+plugin.getDescription().getVersion());
|
||||
player.sendMessage(ChatColor.GOLD+"http://www.mcmmo.info"+ChatColor.DARK_AQUA+" - mcMMO Website");
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.getInstance().motd(player)) {
|
||||
player.sendMessage(ChatColor.GOLD + "Server is running " + ChatColor.GREEN + plugin.getName() + " " + plugin.getDescription().getVersion()); //TODO: Locale
|
||||
player.sendMessage(ChatColor.GOLD + "http://www.mcmmo.info" + ChatColor.DARK_AQUA + " - mcMMO Website"); //TODO: Locale
|
||||
//player.sendMessage(LocaleLoader.getString("mcMMO.MOTD", new Object[] {plugin.getDescription().getVersion()}));
|
||||
//player.sendMessage(LocaleLoader.getString("mcMMO.Website"));
|
||||
}
|
||||
@ -186,7 +186,6 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Action action = event.getAction();
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack is = player.getItemInHand();
|
||||
@ -210,12 +209,12 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
else if (Config.getInstance().getToolModsEnabled() && ItemChecks.isCustomTool(is) && ModChecks.getToolFromItemStack(is).isRepairable()) {
|
||||
else if (ItemChecks.isCustomTool(is) && ModChecks.getToolFromItemStack(is).isRepairable()) {
|
||||
Repair.repairCheck(player, is);
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
else if (Config.getInstance().getArmorModsEnabled() && ItemChecks.isCustomArmor(is) && ModChecks.getArmorFromItemStack(is).isRepairable()) {
|
||||
else if (ItemChecks.isCustomArmor(is) && ModChecks.getArmorFromItemStack(is).isRepairable()) {
|
||||
Repair.repairCheck(player, is);
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
@ -331,7 +330,8 @@ public class PlayerListener implements Listener {
|
||||
|
||||
event.setFormat(bracketColor + "(" + ChatColor.WHITE + "%1$s" + bracketColor + ") %2$s");
|
||||
event.getRecipients().retainAll(intendedRecipients);
|
||||
} else if (PP.getAdminChatMode()) {
|
||||
}
|
||||
else if (PP.getAdminChatMode()) {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), event.getMessage());
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class Archery {
|
||||
Entry<Entity, Integer> entry = it.next();
|
||||
|
||||
if (entry.getKey() == entity) {
|
||||
Misc.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), entry.getValue());
|
||||
Misc.dropItems(entity.getLocation(), new ItemStack(Material.ARROW), entry.getValue());
|
||||
it.remove();
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class Unarmed {
|
||||
if (random.nextInt(3000) <= skillCheck && !ironGrip(defender, attacker)) {
|
||||
defender.sendMessage(LocaleLoader.getString("Skills.Disarmed"));
|
||||
|
||||
Misc.mcDropItem(defender.getLocation(), inHand);
|
||||
Misc.dropItem(defender.getLocation(), inHand);
|
||||
defender.setItemInHand(new ItemStack(Material.AIR));
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class Excavation {
|
||||
//Drop items
|
||||
for (ItemStack x : is) {
|
||||
if (x != null) {
|
||||
Misc.mcDropItem(loc, x);
|
||||
Misc.dropItem(loc, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,91 +187,91 @@ public class Fishing {
|
||||
|
||||
switch (type) {
|
||||
case BLAZE:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD));
|
||||
Misc.dropItem(loc, new ItemStack(Material.BLAZE_ROD));
|
||||
break;
|
||||
|
||||
case CAVE_SPIDER:
|
||||
if (DROP_NUMBER > 50) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
|
||||
Misc.dropItem(loc, new ItemStack(Material.SPIDER_EYE));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.STRING));
|
||||
Misc.dropItem(loc, new ItemStack(Material.STRING));
|
||||
}
|
||||
break;
|
||||
|
||||
case CHICKEN:
|
||||
if (DROP_NUMBER > 66) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.FEATHER));
|
||||
Misc.dropItem(loc, new ItemStack(Material.FEATHER));
|
||||
}
|
||||
else if (DROP_NUMBER > 33) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN));
|
||||
Misc.dropItem(loc, new ItemStack(Material.RAW_CHICKEN));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.EGG));
|
||||
Misc.dropItem(loc, new ItemStack(Material.EGG));
|
||||
}
|
||||
break;
|
||||
|
||||
case COW:
|
||||
if (DROP_NUMBER > 99) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
|
||||
Misc.dropItem(loc, new ItemStack(Material.MILK_BUCKET));
|
||||
}
|
||||
else if (DROP_NUMBER > 50) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.LEATHER));
|
||||
Misc.dropItem(loc, new ItemStack(Material.LEATHER));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
|
||||
Misc.dropItem(loc, new ItemStack(Material.RAW_BEEF));
|
||||
}
|
||||
break;
|
||||
|
||||
case CREEPER:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.SULPHUR));
|
||||
Misc.dropItem(loc, new ItemStack(Material.SULPHUR));
|
||||
break;
|
||||
|
||||
case ENDERMAN:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL));
|
||||
Misc.dropItem(loc, new ItemStack(Material.ENDER_PEARL));
|
||||
break;
|
||||
|
||||
case GHAST:
|
||||
if (DROP_NUMBER > 50) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.SULPHUR));
|
||||
Misc.dropItem(loc, new ItemStack(Material.SULPHUR));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR));
|
||||
Misc.dropItem(loc, new ItemStack(Material.GHAST_TEAR));
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGMA_CUBE:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM));
|
||||
Misc.dropItem(loc, new ItemStack(Material.MAGMA_CREAM));
|
||||
break;
|
||||
|
||||
case MUSHROOM_COW:
|
||||
if (DROP_NUMBER > 99) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
|
||||
Misc.dropItem(loc, new ItemStack(Material.MILK_BUCKET));
|
||||
}
|
||||
else if (DROP_NUMBER > 98) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP));
|
||||
Misc.dropItem(loc, new ItemStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
else if (DROP_NUMBER > 66) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.LEATHER));
|
||||
Misc.dropItem(loc, new ItemStack(Material.LEATHER));
|
||||
}
|
||||
else if (DROP_NUMBER > 33) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
|
||||
Misc.dropItem(loc, new ItemStack(Material.RAW_BEEF));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3);
|
||||
Misc.dropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case PIG:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.PORK));
|
||||
Misc.dropItem(loc, new ItemStack(Material.PORK));
|
||||
break;
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
if (DROP_NUMBER > 50) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
|
||||
Misc.dropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET));
|
||||
Misc.dropItem(loc, new ItemStack(Material.GOLD_NUGGET));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -285,48 +285,48 @@ public class Fishing {
|
||||
ItemStack theWool = wool.toItemStack();
|
||||
theWool.setAmount(1 + random.nextInt(6));
|
||||
|
||||
Misc.mcDropItem(loc, theWool);
|
||||
Misc.dropItem(loc, theWool);
|
||||
sheep.setSheared(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
if (DROP_NUMBER > 50) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.BONE));
|
||||
Misc.dropItem(loc, new ItemStack(Material.BONE));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItems(loc, new ItemStack(Material.ARROW), 3);
|
||||
Misc.dropItems(loc, new ItemStack(Material.ARROW), 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIME:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.SLIME_BALL));
|
||||
Misc.dropItem(loc, new ItemStack(Material.SLIME_BALL));
|
||||
break;
|
||||
|
||||
case SNOWMAN:
|
||||
if (DROP_NUMBER > 99) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.PUMPKIN));
|
||||
Misc.dropItem(loc, new ItemStack(Material.PUMPKIN));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItems(loc, new ItemStack(Material.SNOW_BALL), 5);
|
||||
Misc.dropItems(loc, new ItemStack(Material.SNOW_BALL), 5);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPIDER:
|
||||
if (DROP_NUMBER > 50) {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
|
||||
Misc.dropItem(loc, new ItemStack(Material.SPIDER_EYE));
|
||||
}
|
||||
else {
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.STRING));
|
||||
Misc.dropItem(loc, new ItemStack(Material.STRING));
|
||||
}
|
||||
break;
|
||||
|
||||
case SQUID:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0));
|
||||
Misc.dropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0));
|
||||
break;
|
||||
|
||||
case ZOMBIE:
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
|
||||
Misc.dropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -213,75 +213,75 @@ public class Herbalism {
|
||||
switch (type) {
|
||||
case BROWN_MUSHROOM:
|
||||
if (configInstance.getBrownMushroomsDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
case CACTUS:
|
||||
if (configInstance.getCactiDoubleDropsEnabled()) {
|
||||
Misc.mcDropItems(loc, is, catciDrops);
|
||||
Misc.dropItems(loc, is, catciDrops);
|
||||
}
|
||||
break;
|
||||
|
||||
case CROPS:
|
||||
if (configInstance.getWheatDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
case MELON_BLOCK:
|
||||
if (configInstance.getMelonsDoubleDropsEnabled()) {
|
||||
Misc.mcDropItems(loc, is, 3);
|
||||
Misc.mcRandomDropItems(loc, is, 50, 4);
|
||||
Misc.dropItems(loc, is, 3);
|
||||
Misc.randomDropItems(loc, is, 50, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case NETHER_WARTS:
|
||||
if (configInstance.getNetherWartsDoubleDropsEnabled()) {
|
||||
Misc.mcDropItems(loc, is, 2);
|
||||
Misc.mcRandomDropItems(loc, is, 50, 3);
|
||||
Misc.dropItems(loc, is, 2);
|
||||
Misc.randomDropItems(loc, is, 50, 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case PUMPKIN:
|
||||
if (configInstance.getPumpkinsDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
case RED_MUSHROOM:
|
||||
if (configInstance.getRedMushroomsDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
case SUGAR_CANE_BLOCK:
|
||||
if (configInstance.getSugarCaneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItems(loc, is, caneDrops);
|
||||
Misc.dropItems(loc, is, caneDrops);
|
||||
}
|
||||
break;
|
||||
|
||||
case VINE:
|
||||
if (configInstance.getVinesDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
case WATER_LILY:
|
||||
if (configInstance.getWaterLiliesDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
case YELLOW_FLOWER:
|
||||
if (configInstance.getYellowFlowersDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (customPlant) {
|
||||
Misc.mcDropItem(loc, is);
|
||||
Misc.dropItem(loc, is);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -312,8 +312,8 @@ public class Herbalism {
|
||||
if (hasSeeds && PP.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= herbLevel)) {
|
||||
event.setCancelled(true);
|
||||
|
||||
Misc.mcDropItem(loc, new ItemStack(Material.WHEAT));
|
||||
Misc.mcRandomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3);
|
||||
Misc.dropItem(loc, new ItemStack(Material.WHEAT));
|
||||
Misc.randomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3);
|
||||
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1);
|
||||
|
||||
|
@ -52,44 +52,44 @@ public class Mining {
|
||||
|
||||
case COAL_ORE:
|
||||
if (configInstance.getCoalDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
if (configInstance.getDiamondDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case REDSTONE_ORE:
|
||||
if (configInstance.getRedstoneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
if (configInstance.getLapisDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
if (configInstance.getStoneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -111,20 +111,20 @@ public class Mining {
|
||||
case COAL_ORE:
|
||||
if (configInstance.getCoalDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
if (configInstance.getDiamondDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.DIAMOND);
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case ENDER_STONE:
|
||||
if (configInstance.getEndStoneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -132,74 +132,74 @@ public class Mining {
|
||||
case REDSTONE_ORE:
|
||||
if (configInstance.getRedstoneDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.REDSTONE);
|
||||
Misc.mcDropItems(loc, item, 4);
|
||||
Misc.mcRandomDropItem(loc, item, 50);
|
||||
Misc.dropItems(loc, item, 4);
|
||||
Misc.randomDropItem(loc, item, 50);
|
||||
}
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.GLOWSTONE_DUST);
|
||||
Misc.mcDropItems(loc, item, 2);
|
||||
Misc.mcRandomDropItems(loc, item, 50, 2);
|
||||
Misc.dropItems(loc, item, 2);
|
||||
Misc.randomDropItems(loc, item, 50, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case GOLD_ORE:
|
||||
if (configInstance.getGoldDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case IRON_ORE:
|
||||
if (configInstance.getIronDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
if (configInstance.getLapisDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
|
||||
Misc.mcDropItems(loc, item, 4);
|
||||
Misc.mcRandomDropItems(loc, item, 50, 4);
|
||||
Misc.dropItems(loc, item, 4);
|
||||
Misc.randomDropItems(loc, item, 50, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case MOSSY_COBBLESTONE:
|
||||
if (configInstance.getMossyCobblestoneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case NETHERRACK:
|
||||
if (configInstance.getNetherrackDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case OBSIDIAN:
|
||||
if (configInstance.getObsidianDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case SANDSTONE:
|
||||
if (configInstance.getSandstoneDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
if (configInstance.getStoneDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.COBBLESTONE);
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
item = ModChecks.getCustomBlock(block).getItemDrop();
|
||||
Misc.mcDropItem(loc, item);
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class WoodCutting {
|
||||
x.setData((byte) 0x0);
|
||||
x.setType(Material.AIR);
|
||||
|
||||
Misc.mcDropItem(x.getLocation(), item);
|
||||
Misc.dropItem(x.getLocation(), item);
|
||||
}
|
||||
else if (ModChecks.isCustomLeafBlock(x)) {
|
||||
final int SAPLING_DROP_CHANCE = 10;
|
||||
@ -114,7 +114,7 @@ public class WoodCutting {
|
||||
x.setData((byte) 0x0);
|
||||
x.setType(Material.AIR);
|
||||
|
||||
Misc.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||
}
|
||||
}
|
||||
else if (x.getType() == Material.LOG) {
|
||||
@ -172,13 +172,13 @@ public class WoodCutting {
|
||||
x.setType(Material.AIR);
|
||||
|
||||
/* Drop the block */
|
||||
Misc.mcDropItem(x.getLocation(), item);
|
||||
Misc.dropItem(x.getLocation(), item);
|
||||
}
|
||||
else if (x.getType() == Material.LEAVES) {
|
||||
final int SAPLING_DROP_CHANCE = 10;
|
||||
|
||||
item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling
|
||||
Misc.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||
|
||||
//Remove the block
|
||||
x.setData((byte) 0);
|
||||
@ -287,7 +287,7 @@ public class WoodCutting {
|
||||
if (configInstance.getBlockModsEnabled() && ModChecks.isCustomLogBlock(block)) {
|
||||
item = ModChecks.getCustomBlock(block).getItemDrop();
|
||||
location = block.getLocation();
|
||||
Misc.mcDropItem(location, item);
|
||||
Misc.dropItem(location, item);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -299,25 +299,25 @@ public class WoodCutting {
|
||||
switch (species) {
|
||||
case GENERIC:
|
||||
if (configInstance.getOakDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(location, item);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case REDWOOD:
|
||||
if (configInstance.getSpruceDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(location, item);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case BIRCH:
|
||||
if (configInstance.getBirchDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(location, item);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case JUNGLE:
|
||||
if (configInstance.getJungleDoubleDropsEnabled()) {
|
||||
Misc.mcDropItem(location, item);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -197,9 +197,9 @@ public class Misc {
|
||||
* @param is The items to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void mcDropItems(Location location, ItemStack is, int quantity) {
|
||||
public static void dropItems(Location location, ItemStack is, int quantity) {
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
mcDropItem(location, is);
|
||||
dropItem(location, is);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,9 +210,9 @@ public class Misc {
|
||||
* @param is The item to drop
|
||||
* @param chance The percentage chance for the item to drop
|
||||
*/
|
||||
public static void mcRandomDropItem(Location location, ItemStack is, double chance) {
|
||||
public static void randomDropItem(Location location, ItemStack is, double chance) {
|
||||
if (random.nextInt(100) < chance) {
|
||||
mcDropItem(location, is);
|
||||
dropItem(location, is);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,9 +224,9 @@ public class Misc {
|
||||
* @param chance The percentage chance for the item to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void mcRandomDropItems(Location location, ItemStack is, int chance, int quantity) {
|
||||
public static void randomDropItems(Location location, ItemStack is, int chance, int quantity) {
|
||||
for(int i = 0; i < quantity; i++) {
|
||||
mcRandomDropItem(location, is, chance);
|
||||
randomDropItem(location, is, chance);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ public class Misc {
|
||||
* @param location The location to drop the item at
|
||||
* @param itemStack The item to drop
|
||||
*/
|
||||
public static void mcDropItem(Location location, ItemStack itemStack) {
|
||||
public static void dropItem(Location location, ItemStack itemStack) {
|
||||
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
||||
|
Loading…
Reference in New Issue
Block a user