mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Updates to Blast Mining.
This commit is contained in:
parent
0f89a9e1e8
commit
d13549ff6a
@ -19,9 +19,11 @@ package com.gmail.nossr50.config;
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
@ -35,7 +37,7 @@ public class Misc
|
||||
public HashSet<Block> blockWatchList = new HashSet<Block>();
|
||||
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||
public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
|
||||
public HashMap<Block, Integer> tntTracker = new HashMap<Block, Integer>();
|
||||
public HashMap<Location, Player> tntTracker = new HashMap<Location, Player>();
|
||||
mcMMO plugin = null;
|
||||
|
||||
//BLEED QUE STUFF
|
||||
|
@ -75,7 +75,7 @@ public class mcBlockListener implements Listener
|
||||
if(id == 46 && mcPermissions.getInstance().blastmining(player))
|
||||
{
|
||||
int skill = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
plugin.misc.tntTracker.put(block, skill);
|
||||
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
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -180,12 +181,21 @@ public class mcEntityListener implements Listener
|
||||
{
|
||||
if(event.getEntity() instanceof TNTPrimed)
|
||||
{
|
||||
Block block = event.getEntity().getLocation().getBlock();
|
||||
Location location = event.getEntity().getLocation();
|
||||
System.out.println("TNT Primed.");
|
||||
|
||||
if(plugin.misc.tntTracker.get(block) != null)
|
||||
//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(location.toString());
|
||||
|
||||
if(plugin.misc.tntTracker.get(location) != null)
|
||||
{
|
||||
int skillLevel = plugin.misc.tntTracker.get(block);
|
||||
BlastMining.biggerBombs(skillLevel, event);
|
||||
System.out.println("Being Tracked.");
|
||||
Player player = plugin.misc.tntTracker.get(location);
|
||||
|
||||
BlastMining.biggerBombs(Users.getProfile(player).getSkillLevel(SkillType.MINING), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,12 +205,20 @@ public class mcEntityListener implements Listener
|
||||
{
|
||||
if(event.getEntity() instanceof TNTPrimed)
|
||||
{
|
||||
Block block = event.getLocation().getBlock();
|
||||
Location location = event.getEntity().getLocation();
|
||||
System.out.println("TNT Explode.");
|
||||
|
||||
//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(location.toString());
|
||||
|
||||
if(plugin.misc.tntTracker.get(block) != null)
|
||||
if(plugin.misc.tntTracker.get(location) != null)
|
||||
{
|
||||
int skillLevel = plugin.misc.tntTracker.get(block);
|
||||
BlastMining.dropProcessing(skillLevel, event, plugin);
|
||||
System.out.println("Being Tracked.");
|
||||
Player player = plugin.misc.tntTracker.get(location);
|
||||
BlastMining.dropProcessing(Users.getProfile(player).getSkillLevel(SkillType.MINING), event, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,14 +185,6 @@ public class mcPlayerListener implements Listener
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
if(mat.equals(Material.TNT))
|
||||
{
|
||||
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
|
||||
block.setType(Material.AIR);
|
||||
tnt.setFuseTicks(0);
|
||||
// plugin.misc.tntTracker.remove(block);
|
||||
}
|
||||
|
||||
if(LoadProperties.enableAbilities && m.abilityBlockCheck(block))
|
||||
{
|
||||
@ -289,6 +281,20 @@ public class mcPlayerListener implements Listener
|
||||
player.sendMessage(mcLocale.getString("m.TamingSummon"));
|
||||
}
|
||||
}
|
||||
|
||||
if(action == Action.RIGHT_CLICK_AIR)
|
||||
{
|
||||
Block b = player.getTargetBlock(null, 100);
|
||||
if(b.getType().equals(Material.TNT))
|
||||
{
|
||||
TNTPrimed tnt = player.getWorld().spawn(b.getLocation(), TNTPrimed.class);
|
||||
b.setType(Material.AIR);
|
||||
tnt.setFuseTicks(0);
|
||||
if(plugin.misc.tntTracker.get(tnt.getLocation()) != null)
|
||||
System.out.println(tnt.getLocation().toString());
|
||||
// plugin.misc.tntTracker.remove(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
|
Loading…
Reference in New Issue
Block a user