Fix for Blast Mining not always activating bonuses.

This commit is contained in:
GJ 2012-03-05 21:57:46 -05:00
parent 36d6221b3b
commit 36a706b7b6
6 changed files with 16 additions and 38 deletions

View File

@ -12,6 +12,8 @@ Version 2.0.00-dev
+ Added ability to summon Ocelots with Call of the Wild + Added ability to summon Ocelots with Call of the Wild
= Fixed ClassCastException from Taming preventDamage checks = Fixed ClassCastException from Taming preventDamage checks
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow = Fixed issue with Blast Mining not seeing TNT for detonation due to snow
! Changed Call of the Wild to activate on left-click rather than right-click
! Changed Blast Mining to track based on Entity ID vs. Location
Version 1.3.02 Version 1.3.02
+ Added in game guides for Mining, Excavation, and Acrobatics. Simply type /skillname ? to access them + Added in game guides for Mining, Excavation, and Acrobatics. Simply type /skillname ? to access them

View File

@ -19,7 +19,6 @@ package com.gmail.nossr50.config;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -37,7 +36,7 @@ public class Misc
public HashSet<Block> blockWatchList = new HashSet<Block>(); public HashSet<Block> blockWatchList = new HashSet<Block>();
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>(); public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>(); public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
public HashMap<Location, Player> tntTracker = new HashMap<Location, Player>(); public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
mcMMO plugin = null; mcMMO plugin = null;
//BLEED QUE STUFF //BLEED QUE STUFF

View File

@ -70,9 +70,6 @@ public class mcBlockListener implements Listener
int id = block.getTypeId(); int id = block.getTypeId();
Material mat = block.getType(); Material mat = block.getType();
//TNT placement checks - needed for Blast Mining
if(mat.equals(Material.TNT) && mcPermissions.getInstance().blastMining(player))
plugin.misc.tntTracker.put(block.getLocation(), player);
//Check if the blocks placed should be monitored so they do not give out XP in the future //Check if the blocks placed should be monitored so they do not give out XP in the future
if(m.shouldBeWatched(mat)) if(m.shouldBeWatched(mat))
{ {
@ -154,10 +151,6 @@ public class mcBlockListener implements Listener
/* /*
* MINING * MINING
*/ */
//TNT removal checks - needed for Blast Mining
if(id == 46 && plugin.misc.tntTracker.containsKey(block.getLocation()))
plugin.misc.tntTracker.remove(block.getLocation());
if(mcPermissions.getInstance().mining(player)) if(mcPermissions.getInstance().mining(player))
{ {
if(LoadProperties.miningrequirespickaxe && m.isMiningPick(inhand)) if(LoadProperties.miningrequirespickaxe && m.isMiningPick(inhand))

View File

@ -16,7 +16,6 @@
*/ */
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -55,7 +54,6 @@ import com.gmail.nossr50.skills.BlastMining;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Taming; import com.gmail.nossr50.skills.Taming;
public class mcEntityListener implements Listener public class mcEntityListener implements Listener
{ {
private final mcMMO plugin; private final mcMMO plugin;
@ -162,21 +160,13 @@ public class mcEntityListener implements Listener
@EventHandler (priority = EventPriority.LOW) @EventHandler (priority = EventPriority.LOW)
public void onExplosionPrime(ExplosionPrimeEvent event) public void onExplosionPrime(ExplosionPrimeEvent event)
{ {
if(event.getEntity() instanceof TNTPrimed) Entity entity = event.getEntity();
if(entity instanceof TNTPrimed)
{ {
Location location = event.getEntity().getLocation(); int id = entity.getEntityId();
System.out.println("UNNORMALIZED LOCATION"); if(plugin.misc.tntTracker.containsKey(id))
System.out.println(location);
//Ugly code to make it recognize the location
location.setX(location.getBlockX()+1);
location.setY(location.getBlockY());
location.setZ(location.getBlockZ()+1);
System.out.println("NORMALIZED LOCATION");
System.out.println(location);
if(plugin.misc.tntTracker.containsKey(location))
{ {
Player player = plugin.misc.tntTracker.get(location); Player player = plugin.misc.tntTracker.get(id);
BlastMining.biggerBombs(player, event); BlastMining.biggerBombs(player, event);
} }
} }
@ -185,20 +175,15 @@ public class mcEntityListener implements Listener
@EventHandler (priority = EventPriority.LOW) @EventHandler (priority = EventPriority.LOW)
public void onEnitityExplode(EntityExplodeEvent event) public void onEnitityExplode(EntityExplodeEvent event)
{ {
Entity entity = event.getEntity();
if(event.getEntity() instanceof TNTPrimed) if(event.getEntity() instanceof TNTPrimed)
{ {
Location location = event.getEntity().getLocation(); int id = entity.getEntityId();
if(plugin.misc.tntTracker.containsKey(id))
//Ugly code to make it recognize the location
location.setX(location.getBlockX()+1);
location.setY(location.getBlockY());
location.setZ(location.getBlockZ()+1);
if(plugin.misc.tntTracker.containsKey(location))
{ {
Player player = plugin.misc.tntTracker.get(location); Player player = plugin.misc.tntTracker.get(id);
BlastMining.dropProcessing(player, event, plugin); BlastMining.dropProcessing(player, event, plugin);
plugin.misc.tntTracker.remove(location); plugin.misc.tntTracker.remove(id);
} }
} }
} }

View File

@ -259,7 +259,7 @@ public class mcPlayerListener implements Listener
if(action == Action.RIGHT_CLICK_BLOCK && m.abilityBlockCheck(block)) if(action == Action.RIGHT_CLICK_BLOCK && m.abilityBlockCheck(block))
Item.itemchecks(player, plugin); Item.itemchecks(player, plugin);
if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK))
{ {
if(is.getType().equals(Material.RAW_FISH)) if(is.getType().equals(Material.RAW_FISH))
Taming.animalSummon(EntityType.OCELOT, player); Taming.animalSummon(EntityType.OCELOT, player);
@ -294,7 +294,8 @@ public class mcPlayerListener implements Listener
player.sendMessage(ChatColor.GRAY+"**BOOM**"); player.sendMessage(ChatColor.GRAY+"**BOOM**");
TNTPrimed tnt = player.getWorld().spawn(b.getLocation(), TNTPrimed.class); TNTPrimed tnt = player.getWorld().spawn(b.getLocation(), TNTPrimed.class);
plugin.misc.tntTracker.put(tnt.getEntityId(), player);
b.setType(Material.AIR); b.setType(Material.AIR);
tnt.setFuseTicks(0); tnt.setFuseTicks(0);
PP.setSkillDATS(ability, System.currentTimeMillis()); //Save DATS for Blast Mining PP.setSkillDATS(ability, System.currentTimeMillis()); //Save DATS for Blast Mining

View File

@ -195,9 +195,7 @@ public class Taming
world.spawnCreature(player.getLocation(), type); world.spawnCreature(player.getLocation(), type);
int amount = item.getAmount(); int amount = item.getAmount();
System.out.println(amount);
amount = amount - summonAmount; amount = amount - summonAmount;
System.out.println(amount);
player.setItemInHand(new ItemStack(summonItem, amount)); player.setItemInHand(new ItemStack(summonItem, amount));
player.sendMessage(mcLocale.getString("m.TamingSummon")); player.sendMessage(mcLocale.getString("m.TamingSummon"));
} }