HeatControl extinguishes player immediately

Also cleaned up some extraction code
This commit is contained in:
MistPhizzle 2014-08-08 10:16:34 -04:00
parent 55f2cad44d
commit 962ae8ed13
4 changed files with 33 additions and 30 deletions

View file

@ -840,6 +840,7 @@ public class PKListener implements Listener {
Player player = (Player) entity;
if (Methods.getBoundAbility(player) != null && Methods.getBoundAbility(player).equalsIgnoreCase("HeatControl")) {
if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK) {
player.setFireTicks(0);
event.setCancelled(true);
}
}

View file

@ -13,13 +13,13 @@ import com.projectkorra.ProjectKorra.Methods;
import com.projectkorra.ProjectKorra.ProjectKorra;
public class Extraction {
private static Map<String, Long> cooldowns = new HashMap<String, Long>();
private long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.Extraction.Cooldown");
private static int doublechance = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.Extraction.DoubleLootChance");
private static int triplechance = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.Extraction.TripleLootChance");
public Extraction(Player player) {
if (cooldowns.containsKey(player.getName())) {
if (cooldowns.get(player.getName()) + cooldown >= System.currentTimeMillis()) {
@ -28,7 +28,7 @@ public class Extraction {
cooldowns.remove(player.getName());
}
}
Block block = player.getTargetBlock(null, 5);
if (block == null) {
return;
@ -36,28 +36,30 @@ public class Extraction {
if (!Methods.isRegionProtectedFromBuild(player, "Extraction", block.getLocation())) {
if (Methods.canMetalbend(player) && Methods.canBend(player.getName(), "Extraction")) {
switch(block.getType()) {
case IRON_ORE:
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT, getAmount());
break;
case GOLD_ORE:
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT, getAmount());
break;
case QUARTZ_ORE:
block.setType(Material.NETHERRACK);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ, getAmount());
break;
case default:
break;//shouldn't happen
case IRON_ORE:
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT, getAmount()));
break;
case GOLD_ORE:
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT, getAmount()));
break;
case QUARTZ_ORE:
block.setType(Material.NETHERRACK);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ, getAmount()));
break;
default:
break; // shouldn't happen.
}
cooldowns.put(player.getName(), System.currentTimeMillis());
cooldowns.put(player.getName(), System.currentTimeMillis());
}
}
private int getAmount() {
Random rand = new Random();
return rand.nextInt(99) + 1 <= triplechance ? 3 : rand.nextInt(99) + 1 <= doublechance ? 2: 0;
}
}
private int getAmount() {
Random rand = new Random();
return rand.nextInt(99) + 1 <= triplechance ? 3 : rand.nextInt(99) + 1 <= doublechance ? 2: 0;
}
}

View file

@ -43,11 +43,11 @@ public class Enflamed {
public static void dealFlameDamage(Entity entity) {
if (instances.containsKey(entity) && entity instanceof LivingEntity) {
// if (entity instanceof Player) {
// if (!Extinguish.canBurn((Player) entity)) {
// return;
// }
// }
if (entity instanceof Player) {
if (!Extinguish.canBurn((Player) entity)) {
return;
}
}
LivingEntity Lentity = (LivingEntity) entity;
Player source = instances.get(entity);
Lentity.damage(damage, source);

View file

@ -64,7 +64,7 @@ public class Extinguish {
public static boolean canBurn(Player player) {
if (Methods.getBoundAbility(player) != null) {
if (Methods.getBoundAbility(player).equalsIgnoreCase("HeatControl") || FireJet.checkTemporaryImmunity(player)) {
player.setFireTicks(0);
player.setFireTicks(-1);
return false;
}
}