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