mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Merge branch 'master' of https://github.com/TheYeti/mcMMO
This commit is contained in:
commit
dc77d9f434
@ -247,7 +247,7 @@ public class mcBlockListener implements Listener
|
|||||||
* EXCAVATION
|
* EXCAVATION
|
||||||
*/
|
*/
|
||||||
if(Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5)
|
if(Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5)
|
||||||
Excavation.excavationProcCheck(block.getData(), block.getType(), block.getLocation(), player);
|
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||||
/*
|
/*
|
||||||
* HERBALISM
|
* HERBALISM
|
||||||
*/
|
*/
|
||||||
@ -312,54 +312,21 @@ public class mcBlockListener implements Listener
|
|||||||
/*
|
/*
|
||||||
* GIGA DRILL BREAKER CHECKS
|
* GIGA DRILL BREAKER CHECKS
|
||||||
*/
|
*/
|
||||||
if(PP.getGigaDrillBreakerMode() && m.blockBreakSimulate(block, player)
|
if(PP.getGigaDrillBreakerMode()
|
||||||
&& Excavation.canBeGigaDrillBroken(block) && m.isShovel(inhand))
|
&& Excavation.canBeGigaDrillBroken(block)
|
||||||
|
&& m.blockBreakSimulate(block, player)
|
||||||
|
&& mcPermissions.getInstance().excavationAbility(player))
|
||||||
{
|
{
|
||||||
int x = 0;
|
if(LoadProperties.excavationRequiresShovel)
|
||||||
|
|
||||||
while(x < 3)
|
|
||||||
{
|
{
|
||||||
if(block.getData() != (byte)5)
|
if(m.isShovel(inhand)){
|
||||||
Excavation.excavationProcCheck(block.getData(), block.getType(), block.getLocation(), player);
|
event.setInstaBreak(true);
|
||||||
x++;
|
Excavation.gigaDrillBreaker(player, block);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.setInstaBreak(true);
|
||||||
|
Excavation.gigaDrillBreaker(player, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
|
||||||
|
|
||||||
if(block.getType() == Material.GRASS)
|
|
||||||
mat = Material.DIRT;
|
|
||||||
if(block.getType() == Material.CLAY)
|
|
||||||
mat = Material.CLAY_BALL;
|
|
||||||
if(block.getType() == Material.MYCEL)
|
|
||||||
mat = Material.DIRT;
|
|
||||||
|
|
||||||
byte type = block.getData();
|
|
||||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
|
||||||
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
|
|
||||||
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
|
||||||
|
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
|
||||||
{
|
|
||||||
if(!inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
|
|
||||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(item.getType() == Material.CLAY_BALL)
|
|
||||||
{
|
|
||||||
m.mcDropItem(block.getLocation(), item);
|
|
||||||
m.mcDropItem(block.getLocation(), item);
|
|
||||||
m.mcDropItem(block.getLocation(), item);
|
|
||||||
m.mcDropItem(block.getLocation(), item);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
m.mcDropItem(block.getLocation(), item);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Spout stuff
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* BERSERK MODE CHECKS
|
* BERSERK MODE CHECKS
|
||||||
@ -367,7 +334,8 @@ public class mcBlockListener implements Listener
|
|||||||
if(PP.getBerserkMode()
|
if(PP.getBerserkMode()
|
||||||
&& m.blockBreakSimulate(block, player)
|
&& m.blockBreakSimulate(block, player)
|
||||||
&& player.getItemInHand().getTypeId() == 0
|
&& player.getItemInHand().getTypeId() == 0
|
||||||
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78))
|
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)
|
||||||
|
&& mcPermissions.getInstance().unarmedAbility(player))
|
||||||
{
|
{
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
@ -380,14 +348,14 @@ public class mcBlockListener implements Listener
|
|||||||
if(PP.getSuperBreakerMode()
|
if(PP.getSuperBreakerMode()
|
||||||
&& Mining.canBeSuperBroken(block)
|
&& Mining.canBeSuperBroken(block)
|
||||||
&& m.blockBreakSimulate(block, player)
|
&& m.blockBreakSimulate(block, player)
|
||||||
&& mcPermissions.getInstance().mining(player))
|
&& mcPermissions.getInstance().miningAbility(player))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(LoadProperties.miningrequirespickaxe)
|
if(LoadProperties.miningrequirespickaxe)
|
||||||
{
|
{
|
||||||
if(m.isMiningPick(inhand))
|
if(m.isMiningPick(inhand)){
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||||
@ -398,16 +366,18 @@ public class mcBlockListener implements Listener
|
|||||||
* LEAF BLOWER CHECKS
|
* LEAF BLOWER CHECKS
|
||||||
*/
|
*/
|
||||||
if(block.getTypeId() == 18
|
if(block.getTypeId() == 18
|
||||||
&& mcPermissions.getInstance().woodcutting(player)
|
&& mcPermissions.getInstance().woodCuttingAbility(player)
|
||||||
&& PP.getSkillLevel(SkillType.WOODCUTTING) >= 100
|
&& PP.getSkillLevel(SkillType.WOODCUTTING) >= 100
|
||||||
&& m.blockBreakSimulate(block, player))
|
&& m.blockBreakSimulate(block, player))
|
||||||
{
|
{
|
||||||
if(LoadProperties.woodcuttingrequiresaxe)
|
if(LoadProperties.woodcuttingrequiresaxe)
|
||||||
{
|
{
|
||||||
if(m.isAxes(inhand))
|
if(m.isAxes(inhand))
|
||||||
|
event.setInstaBreak(true);
|
||||||
WoodCutting.leafBlower(player, block);
|
WoodCutting.leafBlower(player, block);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
event.setInstaBreak(true);
|
||||||
WoodCutting.leafBlower(player, block);
|
WoodCutting.leafBlower(player, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,12 +22,15 @@ 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 com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
|
|
||||||
|
|
||||||
public class Excavation
|
public class Excavation
|
||||||
@ -74,7 +77,7 @@ public class Excavation
|
|||||||
Material t = block.getType();
|
Material t = block.getType();
|
||||||
return t == Material.DIRT || t == Material.GRASS || t == Material.SAND || t == Material.GRAVEL || t == Material.CLAY || t == Material.MYCEL || t == Material.SOUL_SAND;
|
return t == Material.DIRT || t == Material.GRASS || t == Material.SAND || t == Material.GRAVEL || t == Material.CLAY || t == Material.MYCEL || t == Material.SOUL_SAND;
|
||||||
}
|
}
|
||||||
public static void excavationProcCheck(byte data, Material type, Location loc, Player player)
|
public static void excavationProcCheck(Material type, Location loc, Player player)
|
||||||
{
|
{
|
||||||
if(LoadProperties.excavationRequiresShovel && !m.isShovel(player.getItemInHand()))
|
if(LoadProperties.excavationRequiresShovel && !m.isShovel(player.getItemInHand()))
|
||||||
return;
|
return;
|
||||||
@ -253,4 +256,23 @@ public class Excavation
|
|||||||
PP.addXP(SkillType.EXCAVATION, xp, player);
|
PP.addXP(SkillType.EXCAVATION, xp, player);
|
||||||
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void gigaDrillBreaker(Player player, Block block)
|
||||||
|
{
|
||||||
|
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
|
{
|
||||||
|
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||||
|
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(block.getData() != (byte)5)
|
||||||
|
{
|
||||||
|
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||||
|
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||||
|
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LoadProperties.spoutEnabled)
|
||||||
|
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||||
|
}
|
||||||
}
|
}
|
@ -16,8 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import net.minecraft.server.Enchantment;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
@ -25,6 +23,7 @@ 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.getspout.spoutapi.sound.SoundEffect;
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
@ -90,7 +89,7 @@ public class Mining
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Drop natural block with Silk Touch
|
//Drop natural block with Silk Touch
|
||||||
if(player.getItemInHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH)){
|
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
|
||||||
m.mcDropItem(loc, item);
|
m.mcDropItem(loc, item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -271,7 +270,7 @@ public class Mining
|
|||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
{
|
{
|
||||||
if(!player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY))
|
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +321,7 @@ public class Mining
|
|||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
//OBSIDIAN
|
//OBSIDIAN
|
||||||
else if(id == 49 && block.getData() != (byte) 5)
|
else if(id == 49 && m.getTier(player) >= 4 && block.getData() != (byte) 5)
|
||||||
{
|
{
|
||||||
xp += LoadProperties.mobsidian;
|
xp += LoadProperties.mobsidian;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import net.minecraft.server.Enchantment;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,10 +24,10 @@ 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.Statistic;
|
import org.bukkit.Statistic;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
@ -203,7 +202,7 @@ public class WoodCutting
|
|||||||
public static void leafBlower(Player player, Block block){
|
public static void leafBlower(Player player, Block block){
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
{
|
{
|
||||||
if(!player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY))
|
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,9 +212,6 @@ public class WoodCutting
|
|||||||
m.mcDropItem(block.getLocation(), x);
|
m.mcDropItem(block.getLocation(), x);
|
||||||
}
|
}
|
||||||
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
|
||||||
|
|
||||||
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