mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Framework for Blast Mining
This commit is contained in:
parent
f9e7ae22f2
commit
c70a23dd5c
@ -3,6 +3,7 @@ Changelog:
|
|||||||
|
|
||||||
Version 2.0-dev
|
Version 2.0-dev
|
||||||
- Removed legacy Permission & PEX support. SuperPerms support only now.
|
- Removed legacy Permission & PEX support. SuperPerms support only now.
|
||||||
|
- Added framework for new Mining sub-skill: Blast Mining.
|
||||||
|
|
||||||
Version 1.2.10
|
Version 1.2.10
|
||||||
- Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103)
|
- Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103)
|
||||||
|
@ -18,6 +18,8 @@ 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;
|
||||||
@ -35,6 +37,7 @@ public class Misc
|
|||||||
public ArrayList<Block> treeFeller = new ArrayList<Block>();
|
public ArrayList<Block> treeFeller = new ArrayList<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, Integer> tntTracker = new HashMap<Location, Integer>();
|
||||||
mcMMO plugin = null;
|
mcMMO plugin = null;
|
||||||
|
|
||||||
//BLEED QUE STUFF
|
//BLEED QUE STUFF
|
||||||
|
@ -67,6 +67,7 @@ public class mcBlockListener implements Listener
|
|||||||
Block block;
|
Block block;
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
|
||||||
//When blocks are placed on snow this event reports the wrong block.
|
//When blocks are placed on snow this event reports the wrong block.
|
||||||
if (event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78)
|
if (event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78)
|
||||||
{
|
{
|
||||||
@ -77,6 +78,14 @@ public class mcBlockListener implements Listener
|
|||||||
block = event.getBlock();
|
block = event.getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TNT placement checks - needed for Blast Mining
|
||||||
|
if(block.getTypeId() == 46)
|
||||||
|
{
|
||||||
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
int skill = PP.getSkillLevel(SkillType.MINING);
|
||||||
|
plugin.misc.tntTracker.put(block.getLocation(), skill);
|
||||||
|
}
|
||||||
|
|
||||||
//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(block))
|
if(m.shouldBeWatched(block))
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -29,6 +30,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.Combat;
|
import com.gmail.nossr50.Combat;
|
||||||
@ -40,6 +43,7 @@ import com.gmail.nossr50.datatypes.SkillType;
|
|||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
import com.gmail.nossr50.party.Party;
|
import com.gmail.nossr50.party.Party;
|
||||||
import com.gmail.nossr50.skills.Acrobatics;
|
import com.gmail.nossr50.skills.Acrobatics;
|
||||||
|
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;
|
||||||
|
|
||||||
@ -52,7 +56,7 @@ public class mcEntityListener implements Listener
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
@ -77,6 +81,18 @@ public class mcEntityListener implements Listener
|
|||||||
Users.addUser(defender);
|
Users.addUser(defender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Demolitions Expert
|
||||||
|
*/
|
||||||
|
if(event.getCause() == DamageCause.BLOCK_EXPLOSION)
|
||||||
|
{
|
||||||
|
if(event.getEntity() instanceof Player)
|
||||||
|
{
|
||||||
|
Player player = (Player)event.getEntity();
|
||||||
|
BlastMining.demolitionsExpertise(player, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof LivingEntity)
|
if(event.getEntity() instanceof LivingEntity)
|
||||||
{
|
{
|
||||||
//CraftEntity cEntity = (CraftEntity)event.getEntity();
|
//CraftEntity cEntity = (CraftEntity)event.getEntity();
|
||||||
@ -196,6 +212,27 @@ public class mcEntityListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler (priority = EventPriority.LOW)
|
||||||
|
public void onExplosionPrime(ExplosionPrimeEvent event)
|
||||||
|
{
|
||||||
|
if(event.getEntity() instanceof TNTPrimed)
|
||||||
|
{
|
||||||
|
int skillLevel = plugin.misc.tntTracker.get(event.getEntity().getLocation());
|
||||||
|
BlastMining.biggerBombs(skillLevel, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler (priority = EventPriority.LOW)
|
||||||
|
public void onEnitityExplode(EntityExplodeEvent event)
|
||||||
|
{
|
||||||
|
if(event.getEntity() instanceof TNTPrimed)
|
||||||
|
{
|
||||||
|
int skillLevel = plugin.misc.tntTracker.get(event.getEntity().getLocation());
|
||||||
|
BlastMining.dropProcessing(skillLevel, event, plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isBow(ItemStack is){
|
public boolean isBow(ItemStack is){
|
||||||
if (is.getTypeId() == 261){
|
if (is.getTypeId() == 261){
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user