mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 09:06:46 +01:00
Enum more things, fixed some durability issues with abilities.
This commit is contained in:
parent
a83812d11a
commit
3bc317e7b2
@ -27,7 +27,6 @@ import com.gmail.nossr50.datatypes.SkillType;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -63,7 +62,7 @@ public class mcBlockListener implements Listener
|
|||||||
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().getType().equals(Material.SNOW))
|
||||||
block = event.getBlockAgainst();
|
block = event.getBlockAgainst();
|
||||||
else
|
else
|
||||||
block = event.getBlock();
|
block = event.getBlock();
|
||||||
@ -72,7 +71,7 @@ public class mcBlockListener implements Listener
|
|||||||
Material mat = block.getType();
|
Material mat = block.getType();
|
||||||
|
|
||||||
//TNT placement checks - needed for Blast Mining
|
//TNT placement checks - needed for Blast Mining
|
||||||
if(id == 46 && mcPermissions.getInstance().blastMining(player))
|
if(mat.equals(Material.TNT) && mcPermissions.getInstance().blastMining(player))
|
||||||
plugin.misc.tntTracker.put(block.getLocation(), 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
|
||||||
@ -199,11 +198,9 @@ public class mcBlockListener implements Listener
|
|||||||
{
|
{
|
||||||
block.setData((byte) 0);
|
block.setData((byte) 0);
|
||||||
if(plugin.misc.blockWatchList.contains(block))
|
if(plugin.misc.blockWatchList.contains(block))
|
||||||
{
|
|
||||||
plugin.misc.blockWatchList.remove(block);
|
plugin.misc.blockWatchList.remove(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockDamage(BlockDamageEvent event)
|
public void onBlockDamage(BlockDamageEvent event)
|
||||||
@ -213,6 +210,7 @@ public class mcBlockListener implements Listener
|
|||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
int id = block.getTypeId();
|
int id = block.getTypeId();
|
||||||
|
Material mat = block.getType();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ABILITY PREPARATION CHECKS
|
* ABILITY PREPARATION CHECKS
|
||||||
@ -221,7 +219,7 @@ public class mcBlockListener implements Listener
|
|||||||
{
|
{
|
||||||
if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block))
|
if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block))
|
||||||
Skills.abilityCheck(player, SkillType.HERBALISM);
|
Skills.abilityCheck(player, SkillType.HERBALISM);
|
||||||
if(PP.getAxePreparationMode() && id == 17 && mcPermissions.getInstance().woodCuttingAbility(player))
|
if(PP.getAxePreparationMode() && mat.equals(Material.LOG) && mcPermissions.getInstance().woodCuttingAbility(player))
|
||||||
Skills.abilityCheck(player, SkillType.WOODCUTTING);
|
Skills.abilityCheck(player, SkillType.WOODCUTTING);
|
||||||
if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block))
|
if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block))
|
||||||
Skills.abilityCheck(player, SkillType.MINING);
|
Skills.abilityCheck(player, SkillType.MINING);
|
||||||
@ -229,13 +227,13 @@ public class mcBlockListener implements Listener
|
|||||||
Skills.abilityCheck(player, SkillType.EXCAVATION);
|
Skills.abilityCheck(player, SkillType.EXCAVATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || id == 78))
|
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || mat.equals(Material.SNOW)))
|
||||||
Skills.abilityCheck(player, SkillType.UNARMED);
|
Skills.abilityCheck(player, SkillType.UNARMED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TREE FELLER STUFF
|
* TREE FELLER STUFF
|
||||||
*/
|
*/
|
||||||
if(LoadProperties.spoutEnabled && id == 17 && PP.getTreeFellerMode())
|
if(LoadProperties.spoutEnabled && mat.equals(Material.LOG) && PP.getTreeFellerMode())
|
||||||
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -254,18 +252,8 @@ public class mcBlockListener implements Listener
|
|||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Excavation.gigaDrillBreaker(player, block);
|
Excavation.gigaDrillBreaker(player, block);
|
||||||
}
|
}
|
||||||
else if(!LoadProperties.excavationRequiresShovel){
|
else if(!LoadProperties.excavationRequiresShovel)
|
||||||
|
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
|
||||||
{
|
{
|
||||||
if(!inhand.containsEnchantment(Enchantment.DURABILITY))
|
|
||||||
{
|
|
||||||
short durability = inhand.getDurability();
|
|
||||||
durability += (LoadProperties.abilityDurabilityLoss);
|
|
||||||
inhand.setDurability(durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Excavation.gigaDrillBreaker(player, block);
|
Excavation.gigaDrillBreaker(player, block);
|
||||||
}
|
}
|
||||||
@ -297,16 +285,6 @@ public class mcBlockListener implements Listener
|
|||||||
{
|
{
|
||||||
if(m.isMiningPick(inhand)){
|
if(m.isMiningPick(inhand)){
|
||||||
|
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
|
||||||
{
|
|
||||||
if(!inhand.containsEnchantment(Enchantment.DURABILITY))
|
|
||||||
{
|
|
||||||
short durability = inhand.getDurability();
|
|
||||||
durability += (LoadProperties.abilityDurabilityLoss);
|
|
||||||
inhand.setDurability(durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||||
}
|
}
|
||||||
@ -347,8 +325,6 @@ public class mcBlockListener implements Listener
|
|||||||
Block blockFrom = event.getBlock();
|
Block blockFrom = event.getBlock();
|
||||||
Block blockTo = event.getToBlock();
|
Block blockTo = event.getToBlock();
|
||||||
if(m.shouldBeWatched(blockFrom.getType()) && blockFrom.getData() == (byte)5)
|
if(m.shouldBeWatched(blockFrom.getType()) && blockFrom.getData() == (byte)5)
|
||||||
{
|
|
||||||
blockTo.setData((byte)5);
|
blockTo.setData((byte)5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -24,7 +24,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
|
|
||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
@ -174,16 +173,7 @@ public class Excavation
|
|||||||
|
|
||||||
public static void gigaDrillBreaker(Player player, Block block)
|
public static void gigaDrillBreaker(Player player, Block block)
|
||||||
{
|
{
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
Skills.abilityDurabilityLoss(player.getItemInHand());
|
||||||
{
|
|
||||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
|
||||||
{
|
|
||||||
short durability = player.getItemInHand().getDurability();
|
|
||||||
durability += LoadProperties.abilityDurabilityLoss;
|
|
||||||
player.getItemInHand().setDurability(durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(block.getData() != (byte)5)
|
if(block.getData() != (byte)5)
|
||||||
{
|
{
|
||||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||||
|
@ -18,6 +18,7 @@ package com.gmail.nossr50.skills;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -40,8 +41,8 @@ public class Mining
|
|||||||
public static void blockProcSimulate(Block block, Player player)
|
public static void blockProcSimulate(Block block, Player player)
|
||||||
{
|
{
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
int id = block.getTypeId();
|
Material type = block.getType();
|
||||||
ItemStack item = new ItemStack(id, 1);
|
ItemStack item = new ItemStack(type, 1);
|
||||||
|
|
||||||
//Drop natural block with Silk Touch
|
//Drop natural block with Silk Touch
|
||||||
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
|
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
|
||||||
@ -49,43 +50,33 @@ public class Mining
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (id){
|
switch (type){
|
||||||
//GLOWSTONE
|
case GLOWSTONE:
|
||||||
case 89:
|
item = new ItemStack(Material.GLOWSTONE_DUST, 1);
|
||||||
item = new ItemStack(348, 1);
|
|
||||||
m.mcDropItems(loc, item, 2);
|
m.mcDropItems(loc, item, 2);
|
||||||
m.mcRandomDropItems(loc, item, 50, 2);
|
m.mcRandomDropItems(loc, item, 50, 2);
|
||||||
break;
|
break;
|
||||||
//REDSTONE
|
case GLOWING_REDSTONE_ORE:
|
||||||
case 73:
|
case REDSTONE_ORE:
|
||||||
item = new ItemStack(331, 1);
|
item = new ItemStack(Material.REDSTONE, 1);
|
||||||
m.mcDropItems(loc, item, 4);
|
m.mcDropItems(loc, item, 4);
|
||||||
m.mcRandomDropItem(loc, item, 50);
|
m.mcRandomDropItem(loc, item, 50);
|
||||||
break;
|
break;
|
||||||
case 74:
|
case LAPIS_ORE:
|
||||||
item = new ItemStack(331, 1);
|
item = new ItemStack(Material.INK_SACK, 1, (byte)0, (byte)0x4);
|
||||||
m.mcDropItems(loc, item, 4);
|
|
||||||
m.mcRandomDropItem(loc, item, 50);
|
|
||||||
break;
|
|
||||||
//LAPIS
|
|
||||||
case 21:
|
|
||||||
item = new ItemStack(351, 1, (byte)0,(byte)0x4);
|
|
||||||
m.mcDropItems(loc, item, 4);
|
m.mcDropItems(loc, item, 4);
|
||||||
m.mcRandomDropItems(loc, item, 50, 4);
|
m.mcRandomDropItems(loc, item, 50, 4);
|
||||||
break;
|
break;
|
||||||
//DIAMOND
|
case DIAMOND_ORE:
|
||||||
case 56:
|
item = new ItemStack(Material.DIAMOND, 1);
|
||||||
item = new ItemStack(264, 1);
|
|
||||||
m.mcDropItem(loc, item);
|
m.mcDropItem(loc, item);
|
||||||
break;
|
break;
|
||||||
//STONE
|
case STONE:
|
||||||
case 1:
|
item = new ItemStack(Material.COBBLESTONE, 1);
|
||||||
item = new ItemStack(4, 1);
|
|
||||||
m.mcDropItem(loc, item);
|
m.mcDropItem(loc, item);
|
||||||
break;
|
break;
|
||||||
//COAL
|
case COAL_ORE:
|
||||||
case 16:
|
item = new ItemStack(Material.COAL, 1, (byte)0, (byte)0x0);
|
||||||
item = new ItemStack(263, 1);
|
|
||||||
m.mcDropItem(loc, item);
|
m.mcDropItem(loc, item);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -108,66 +99,50 @@ public class Mining
|
|||||||
if(plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5)
|
if(plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5)
|
||||||
return;
|
return;
|
||||||
int xp = 0;
|
int xp = 0;
|
||||||
int id = block.getTypeId();
|
Material type = block.getType();
|
||||||
|
|
||||||
switch (id) {
|
switch (type) {
|
||||||
//STONE
|
case STONE:
|
||||||
case 1:
|
|
||||||
xp += LoadProperties.mstone;
|
xp += LoadProperties.mstone;
|
||||||
break;
|
break;
|
||||||
//SANDSTONE
|
case SANDSTONE:
|
||||||
case 24:
|
|
||||||
xp += LoadProperties.msandstone;
|
xp += LoadProperties.msandstone;
|
||||||
break;
|
break;
|
||||||
//OBSIDIAN
|
case OBSIDIAN:
|
||||||
case 49:
|
|
||||||
xp += LoadProperties.mobsidian;
|
xp += LoadProperties.mobsidian;
|
||||||
break;
|
break;
|
||||||
//NETHERRACK
|
case NETHERRACK:
|
||||||
case 87:
|
|
||||||
xp += LoadProperties.mnetherrack;
|
xp += LoadProperties.mnetherrack;
|
||||||
break;
|
break;
|
||||||
//GLOWSTONE
|
case GLOWSTONE:
|
||||||
case 89:
|
|
||||||
xp += LoadProperties.mglowstone;
|
xp += LoadProperties.mglowstone;
|
||||||
break;
|
break;
|
||||||
//COAL
|
case COAL_ORE:
|
||||||
case 16:
|
|
||||||
xp += LoadProperties.mcoal;
|
xp += LoadProperties.mcoal;
|
||||||
break;
|
break;
|
||||||
//GOLD
|
case GOLD_ORE:
|
||||||
case 14:
|
|
||||||
xp += LoadProperties.mgold;
|
xp += LoadProperties.mgold;
|
||||||
break;
|
break;
|
||||||
//DIAMOND
|
case DIAMOND_ORE:
|
||||||
case 56:
|
|
||||||
xp += LoadProperties.mdiamond;
|
xp += LoadProperties.mdiamond;
|
||||||
break;
|
break;
|
||||||
//IRON
|
case IRON_ORE:
|
||||||
case 15:
|
|
||||||
xp += LoadProperties.miron;
|
xp += LoadProperties.miron;
|
||||||
break;
|
break;
|
||||||
//REDSTONE
|
case GLOWING_REDSTONE_ORE:
|
||||||
case 73:
|
case REDSTONE_ORE:
|
||||||
xp += LoadProperties.mredstone;
|
xp += LoadProperties.mredstone;
|
||||||
break;
|
break;
|
||||||
case 74:
|
case LAPIS_ORE:
|
||||||
xp += LoadProperties.mredstone;
|
|
||||||
break;
|
|
||||||
//LAPIS
|
|
||||||
case 21:
|
|
||||||
xp += LoadProperties.mlapis;
|
xp += LoadProperties.mlapis;
|
||||||
break;
|
break;
|
||||||
//END STONE
|
case ENDER_STONE:
|
||||||
case 121:
|
|
||||||
xp += LoadProperties.mendstone;
|
xp += LoadProperties.mendstone;
|
||||||
break;
|
break;
|
||||||
//MOSS STONE
|
case MOSSY_COBBLESTONE:
|
||||||
case 48:
|
|
||||||
xp += LoadProperties.mmossstone;
|
xp += LoadProperties.mmossstone;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canBeSuperBroken(block))
|
if(canBeSuperBroken(block))
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
PP.addXP(SkillType.MINING, xp, player);
|
PP.addXP(SkillType.MINING, xp, player);
|
||||||
@ -202,119 +177,98 @@ public class Mining
|
|||||||
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
|
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
Skills.abilityDurabilityLoss(player.getItemInHand());
|
||||||
{
|
|
||||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
|
||||||
{
|
|
||||||
short durability = player.getItemInHand().getDurability();
|
|
||||||
durability += LoadProperties.abilityDurabilityLoss;
|
|
||||||
player.getItemInHand().setDurability(durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Pre-processing
|
//Pre-processing
|
||||||
int id = block.getTypeId();
|
Material type = block.getType();
|
||||||
int xp = 0;
|
int xp = 0;
|
||||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||||
|
|
||||||
//STONE
|
if(type.equals(Material.STONE) && block.getData() != (byte) 5)
|
||||||
if(id == 1 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mstone;
|
xp += LoadProperties.mstone;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//SANDSTONE
|
else if(type.equals(Material.SANDSTONE) && block.getData() != (byte) 5)
|
||||||
else if(id == 24 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.msandstone;
|
xp += LoadProperties.msandstone;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//NETHERRACK
|
else if(type.equals(Material.NETHERRACK) && block.getData() != (byte) 5)
|
||||||
else if(id == 87 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mnetherrack;
|
xp += LoadProperties.mnetherrack;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//GLOWSTONE
|
else if(type.equals(Material.GLOWSTONE) && block.getData() != (byte) 5)
|
||||||
else if(id == 89 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mglowstone;
|
xp += LoadProperties.mglowstone;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//COAL
|
else if(type.equals(Material.COAL_ORE) && block.getData() != (byte) 5)
|
||||||
else if(id == 16 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mcoal;
|
xp += LoadProperties.mcoal;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//GOLD
|
else if(type.equals(Material.GOLD_ORE) && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||||
else if(id == 14 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mgold;
|
xp += LoadProperties.mgold;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//OBSIDIAN
|
else if(type.equals(Material.OBSIDIAN) && m.getTier(player) >= 4 && block.getData() != (byte) 5)
|
||||||
else if(id == 49 && m.getTier(player) >= 4 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mobsidian;
|
xp += LoadProperties.mobsidian;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//DIAMOND
|
else if(type.equals(Material.DIAMOND_ORE) && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||||
else if(id == 56 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mdiamond;
|
xp += LoadProperties.mdiamond;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//IRON
|
else if(type.equals(Material.IRON_ORE) && m.getTier(player) >= 2 && block.getData() != (byte) 5)
|
||||||
else if(id == 15 && m.getTier(player) >= 2 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.miron;
|
xp += LoadProperties.miron;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//REDSTONE
|
else if((type.equals(Material.GLOWING_REDSTONE_ORE) || type.equals(Material.REDSTONE_ORE)) && m.getTier(player) >= 3 && !plugin.misc.blockWatchList.contains(block))
|
||||||
else if((id == 73 || id == 74) && m.getTier(player) >= 3 && !plugin.misc.blockWatchList.contains(block))
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mredstone;
|
xp += LoadProperties.mredstone;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//LAPIS
|
else if(type.equals(Material.LAPIS_ORE) && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||||
else if(id == 21 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mlapis;
|
xp += LoadProperties.mlapis;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//END STONE
|
else if(type.equals(Material.ENDER_STONE) && block.getData() != (byte) 5)
|
||||||
else if(id == 121 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mendstone;
|
xp += LoadProperties.mendstone;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//MOSS STONE
|
else if(type.equals(Material.MOSSY_COBBLESTONE) && block.getData() != (byte) 5)
|
||||||
else if(id == 48 && block.getData() != (byte) 5)
|
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
xp += LoadProperties.mmossstone;
|
xp += LoadProperties.mmossstone;
|
||||||
|
@ -20,7 +20,9 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||||
|
|
||||||
@ -269,6 +271,19 @@ public class Skills
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void abilityDurabilityLoss(ItemStack inhand)
|
||||||
|
{
|
||||||
|
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
|
{
|
||||||
|
if(!inhand.containsEnchantment(Enchantment.DURABILITY))
|
||||||
|
{
|
||||||
|
short durability = inhand.getDurability();
|
||||||
|
durability += (LoadProperties.abilityDurabilityLoss);
|
||||||
|
inhand.setDurability(durability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if an ability can be activated.
|
* Check to see if an ability can be activated.
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,6 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -161,16 +160,7 @@ public class WoodCutting
|
|||||||
|
|
||||||
PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP
|
PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP
|
||||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||||
|
Skills.abilityDurabilityLoss(player.getItemInHand());
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
|
||||||
{
|
|
||||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
|
||||||
{
|
|
||||||
short durability = player.getItemInHand().getDurability();
|
|
||||||
durability += (LoadProperties.abilityDurabilityLoss * durabilityLoss);
|
|
||||||
player.getItemInHand().setDurability(durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean treeFellerCompatible(Block block)
|
private static boolean treeFellerCompatible(Block block)
|
||||||
@ -275,17 +265,7 @@ public class WoodCutting
|
|||||||
|
|
||||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
|
Skills.abilityDurabilityLoss(player.getItemInHand());
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
|
||||||
{
|
|
||||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
|
||||||
{
|
|
||||||
short durability = player.getItemInHand().getDurability();
|
|
||||||
durability += LoadProperties.abilityDurabilityLoss;
|
|
||||||
player.getItemInHand().setDurability(durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user