Extraction: Fixed Dupe Bug

http://projectkorra.com/forum/threads/extraction-dupe-glitch.1905/
This commit is contained in:
nathank33 2015-01-30 18:20:43 -08:00
parent e2ec2d26e3
commit 8b6ede61c6

View file

@ -27,22 +27,38 @@ public class Extraction {
} }
if (!Methods.isRegionProtectedFromBuild(player, "Extraction", block.getLocation())) { if (!Methods.isRegionProtectedFromBuild(player, "Extraction", block.getLocation())) {
if (Methods.canMetalbend(player) && Methods.canBend(player.getName(), "Extraction")) { if (Methods.canMetalbend(player) && Methods.canBend(player.getName(), "Extraction")) {
Material type = null;
switch(block.getType()) { switch(block.getType()) {
case IRON_ORE: case IRON_ORE:
block.setType(Material.STONE); block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT, getAmount())); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT, getAmount()));
type = Material.STONE;
break; break;
case GOLD_ORE: case GOLD_ORE:
block.setType(Material.STONE); block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT, getAmount())); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT, getAmount()));
type = Material.STONE;
break; break;
case QUARTZ_ORE: case QUARTZ_ORE:
block.setType(Material.NETHERRACK); block.setType(Material.NETHERRACK);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ, getAmount())); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ, getAmount()));
type = Material.NETHERRACK;
break; break;
default: default:
break; // shouldn't happen. break; // shouldn't happen.
} }
if(type != null) {
/* Update the block from Methods.movedearth to Stone otherwise
* players can use RaiseEarth > Extraction > Collapse
* to dupe the material from the block.
* */
if(Methods.movedearth.containsKey(block)) {
Methods.movedearth.remove(block);
}
}
Methods.playMetalbendingSound(block.getLocation()); Methods.playMetalbendingSound(block.getLocation());
bPlayer.addCooldown("Extraction", cooldown); bPlayer.addCooldown("Extraction", cooldown);
} }