mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Assorted bug fixes & cleanup.
This commit is contained in:
parent
9dfcbf1797
commit
6e8cfe5ec9
@ -21,6 +21,8 @@ Version 2.0.00-dev
|
|||||||
= Fixed issue where every block broken had a herbalism check applied
|
= Fixed issue where every block broken had a herbalism check applied
|
||||||
= Fixed issue where blocks weren't being removed from the watchlist
|
= Fixed issue where blocks weren't being removed from the watchlist
|
||||||
= Fixed exploit where you could use /ptp to teleport to anyone
|
= Fixed exploit where you could use /ptp to teleport to anyone
|
||||||
|
= Fixed bug where Green Terra didn't work on Stone Brick
|
||||||
|
= Fixed bug where Tree Feller could be used without permissions
|
||||||
! Changed inspect failed message to say inspect rather than whois
|
! Changed inspect failed message to say inspect rather than whois
|
||||||
! Changed Call of the Wild to activate on left-click rather than right-click
|
! 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
|
! Changed Blast Mining to track based on Entity ID vs. Location
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package com.gmail.nossr50.datatypes;
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
import com.gmail.nossr50.skills.Excavation;
|
||||||
|
import com.gmail.nossr50.skills.Herbalism;
|
||||||
|
import com.gmail.nossr50.skills.Mining;
|
||||||
|
|
||||||
public enum AbilityType
|
public enum AbilityType
|
||||||
{
|
{
|
||||||
@ -15,7 +20,8 @@ public enum AbilityType
|
|||||||
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
|
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
|
||||||
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
|
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
|
||||||
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
|
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
|
||||||
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null);
|
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
|
||||||
|
LEAF_BLOWER(0, null, null, null, null, null);
|
||||||
|
|
||||||
private int cooldown;
|
private int cooldown;
|
||||||
private String abilityOn;
|
private String abilityOn;
|
||||||
@ -118,10 +124,10 @@ public enum AbilityType
|
|||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
{
|
{
|
||||||
case BLAST_MINING:
|
|
||||||
return PP.getBlastMiningInformed();
|
|
||||||
case BERSERK:
|
case BERSERK:
|
||||||
return PP.getBerserkInformed();
|
return PP.getBerserkInformed();
|
||||||
|
case BLAST_MINING:
|
||||||
|
return PP.getBlastMiningInformed();
|
||||||
case SUPER_BREAKER:
|
case SUPER_BREAKER:
|
||||||
return PP.getSuperBreakerInformed();
|
return PP.getSuperBreakerInformed();
|
||||||
case GIGA_DRILL_BREAKER:
|
case GIGA_DRILL_BREAKER:
|
||||||
@ -142,12 +148,12 @@ public enum AbilityType
|
|||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
{
|
{
|
||||||
case BLAST_MINING:
|
|
||||||
PP.setBlastMiningInformed(bool);
|
|
||||||
break;
|
|
||||||
case BERSERK:
|
case BERSERK:
|
||||||
PP.setBerserkInformed(bool);
|
PP.setBerserkInformed(bool);
|
||||||
break;
|
break;
|
||||||
|
case BLAST_MINING:
|
||||||
|
PP.setBlastMiningInformed(bool);
|
||||||
|
break;
|
||||||
case SUPER_BREAKER:
|
case SUPER_BREAKER:
|
||||||
PP.setSuperBreakerInformed(bool);
|
PP.setSuperBreakerInformed(bool);
|
||||||
break;
|
break;
|
||||||
@ -175,10 +181,14 @@ public enum AbilityType
|
|||||||
{
|
{
|
||||||
case BERSERK:
|
case BERSERK:
|
||||||
return mcPermissions.getInstance().unarmedAbility(player);
|
return mcPermissions.getInstance().unarmedAbility(player);
|
||||||
|
case BLAST_MINING:
|
||||||
|
return mcPermissions.getInstance().blastMining(player);
|
||||||
case GIGA_DRILL_BREAKER:
|
case GIGA_DRILL_BREAKER:
|
||||||
return mcPermissions.getInstance().excavationAbility(player);
|
return mcPermissions.getInstance().excavationAbility(player);
|
||||||
case GREEN_TERRA:
|
case GREEN_TERRA:
|
||||||
return mcPermissions.getInstance().herbalismAbility(player);
|
return mcPermissions.getInstance().herbalismAbility(player);
|
||||||
|
case LEAF_BLOWER:
|
||||||
|
return mcPermissions.getInstance().woodcutting(player);
|
||||||
case SERRATED_STRIKES:
|
case SERRATED_STRIKES:
|
||||||
return mcPermissions.getInstance().swordsAbility(player);
|
return mcPermissions.getInstance().swordsAbility(player);
|
||||||
case SKULL_SPLIITER:
|
case SKULL_SPLIITER:
|
||||||
@ -187,9 +197,26 @@ public enum AbilityType
|
|||||||
return mcPermissions.getInstance().miningAbility(player);
|
return mcPermissions.getInstance().miningAbility(player);
|
||||||
case TREE_FELLER:
|
case TREE_FELLER:
|
||||||
return mcPermissions.getInstance().woodCuttingAbility(player);
|
return mcPermissions.getInstance().woodCuttingAbility(player);
|
||||||
case BLAST_MINING:
|
|
||||||
return mcPermissions.getInstance().blastMining(player);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean blockCheck(Block block) {
|
||||||
|
switch (this) {
|
||||||
|
case BERSERK:
|
||||||
|
return (Excavation.canBeGigaDrillBroken(block) || block.getType().equals(Material.SNOW));
|
||||||
|
case GIGA_DRILL_BREAKER:
|
||||||
|
return Excavation.canBeGigaDrillBroken(block);
|
||||||
|
case GREEN_TERRA:
|
||||||
|
return Herbalism.canBeGreenTerra(block);
|
||||||
|
case LEAF_BLOWER:
|
||||||
|
return block.getType().equals(Material.LEAVES);
|
||||||
|
case SUPER_BREAKER:
|
||||||
|
return Mining.canBeSuperBroken(block);
|
||||||
|
case TREE_FELLER:
|
||||||
|
return block.getType().equals(Material.LOG);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -3,14 +3,15 @@ package com.gmail.nossr50.listeners;
|
|||||||
import com.gmail.nossr50.BlockChecks;
|
import com.gmail.nossr50.BlockChecks;
|
||||||
import com.gmail.nossr50.ItemChecks;
|
import com.gmail.nossr50.ItemChecks;
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
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.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -21,6 +22,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
@ -138,28 +140,27 @@ public class mcBlockListener implements Listener {
|
|||||||
* WOOD CUTTING
|
* WOOD CUTTING
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) {
|
if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) {
|
||||||
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
|
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
|
||||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||||
}
|
}
|
||||||
else if (!LoadProperties.woodcuttingrequiresaxe) {
|
else if (!LoadProperties.woodcuttingrequiresaxe) {
|
||||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PP.getTreeFellerMode()) {
|
|
||||||
WoodCutting.treeFeller(event, plugin);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PP.getTreeFellerMode() && mcPermissions.getInstance().woodCuttingAbility(player)) {
|
||||||
|
WoodCutting.treeFeller(event, plugin);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* EXCAVATION
|
* EXCAVATION
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 0x5) {
|
if (Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 0x5) {
|
||||||
if(LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
|
if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
|
||||||
Excavation.excavationProcCheck(block, player);
|
Excavation.excavationProcCheck(block, player);
|
||||||
}
|
}
|
||||||
else if(!LoadProperties.excavationRequiresShovel) {
|
else if (!LoadProperties.excavationRequiresShovel) {
|
||||||
Excavation.excavationProcCheck(block, player);
|
Excavation.excavationProcCheck(block, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,119 +174,92 @@ public class mcBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Monitor BlockDamage events.
|
||||||
|
*
|
||||||
|
* @param event The event to monitor
|
||||||
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockDamage(BlockDamageEvent event)
|
public void onBlockDamage(BlockDamageEvent event) {
|
||||||
{
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
int id = block.getTypeId();
|
|
||||||
Material mat = block.getType();
|
Material mat = block.getType();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ABILITY PREPARATION CHECKS
|
* ABILITY PREPARATION CHECKS
|
||||||
*/
|
*/
|
||||||
if(BlockChecks.abilityBlockCheck(mat))
|
if (BlockChecks.abilityBlockCheck(mat)) {
|
||||||
{
|
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() && mat.equals(Material.LOG) && mcPermissions.getInstance().woodCuttingAbility(player))
|
else if (PP.getAxePreparationMode() && mat.equals(Material.LOG) && mcPermissions.getInstance().woodCuttingAbility(player)) { //Why are we checking the permissions here?
|
||||||
Skills.abilityCheck(player, SkillType.WOODCUTTING);
|
Skills.abilityCheck(player, SkillType.WOODCUTTING);
|
||||||
if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block))
|
}
|
||||||
|
else if (PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block)) {
|
||||||
Skills.abilityCheck(player, SkillType.MINING);
|
Skills.abilityCheck(player, SkillType.MINING);
|
||||||
if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block))
|
}
|
||||||
|
else if (PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block)) {
|
||||||
Skills.abilityCheck(player, SkillType.EXCAVATION);
|
Skills.abilityCheck(player, SkillType.EXCAVATION);
|
||||||
|
}
|
||||||
|
else if (PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || mat.equals(Material.SNOW))) {
|
||||||
|
Skills.abilityCheck(player, SkillType.UNARMED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || mat.equals(Material.SNOW)))
|
/* TREE FELLER SOUNDS */
|
||||||
Skills.abilityCheck(player, SkillType.UNARMED);
|
if (LoadProperties.spoutEnabled && mat.equals(Material.LOG) && PP.getTreeFellerMode()) {
|
||||||
|
|
||||||
/*
|
|
||||||
* TREE FELLER STUFF
|
|
||||||
*/
|
|
||||||
if(LoadProperties.spoutEnabled && mat.equals(Material.LOG) && PP.getTreeFellerMode())
|
|
||||||
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GREEN TERRA STUFF
|
* ABILITY TRIGGER CHECKS
|
||||||
*/
|
*/
|
||||||
if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player))
|
if (Skills.triggerCheck(player, block, AbilityType.GREEN_TERRA)) {
|
||||||
Herbalism.greenTerra(player, block);
|
Herbalism.greenTerra(player, block);
|
||||||
|
}
|
||||||
/*
|
else if (Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
|
||||||
* GIGA DRILL BREAKER CHECKS
|
if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
|
||||||
*/
|
|
||||||
if(PP.getGigaDrillBreakerMode() && Excavation.canBeGigaDrillBroken(block) && m.blockBreakSimulate(block, player, true) && mcPermissions.getInstance().excavationAbility(player))
|
|
||||||
{
|
|
||||||
if(LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand))
|
|
||||||
{
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Excavation.gigaDrillBreaker(player, block);
|
Excavation.gigaDrillBreaker(player, block);
|
||||||
}
|
}
|
||||||
else if(!LoadProperties.excavationRequiresShovel)
|
else if (!LoadProperties.excavationRequiresShovel) {
|
||||||
{
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Excavation.gigaDrillBreaker(player, block);
|
Excavation.gigaDrillBreaker(player, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
else if (Skills.triggerCheck(player, block, AbilityType.BERSERK)) {
|
||||||
* BERSERK MODE CHECKS
|
if (inhand.getType().equals(Material.AIR)) {
|
||||||
*/
|
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||||
if(PP.getBerserkMode()
|
Bukkit.getPluginManager().callEvent(armswing);
|
||||||
&& m.blockBreakSimulate(block, player, true)
|
|
||||||
&& player.getItemInHand().getTypeId() == 0
|
event.setInstaBreak(true);
|
||||||
&& (Excavation.canBeGigaDrillBroken(block) || id == 78)
|
}
|
||||||
&& mcPermissions.getInstance().unarmedAbility(player))
|
|
||||||
{
|
if (LoadProperties.spoutEnabled) {
|
||||||
event.setInstaBreak(true);
|
|
||||||
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
|
||||||
/*
|
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
|
||||||
* SUPER BREAKER CHECKS
|
event.setInstaBreak(true);
|
||||||
*/
|
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||||
if(PP.getSuperBreakerMode()
|
}
|
||||||
&& Mining.canBeSuperBroken(block)
|
else if (!LoadProperties.miningrequirespickaxe) {
|
||||||
&& m.blockBreakSimulate(block, player, true)
|
|
||||||
&& mcPermissions.getInstance().miningAbility(player))
|
|
||||||
{
|
|
||||||
if(LoadProperties.miningrequirespickaxe)
|
|
||||||
{
|
|
||||||
if(ItemChecks.isMiningPick(inhand)){
|
|
||||||
|
|
||||||
event.setInstaBreak(true);
|
|
||||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100) {
|
||||||
/*
|
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
|
||||||
* LEAF BLOWER CHECKS
|
event.setInstaBreak(true);
|
||||||
*/
|
WoodCutting.leafBlower(player, block);
|
||||||
if(id == 18
|
}
|
||||||
&& mcPermissions.getInstance().woodCuttingAbility(player)
|
else if (!LoadProperties.woodcuttingrequiresaxe && inhand.getType().equals(Material.SHEARS)) {
|
||||||
&& PP.getSkillLevel(SkillType.WOODCUTTING) >= 100
|
|
||||||
&& m.blockBreakSimulate(block, player, true))
|
|
||||||
{
|
|
||||||
if(LoadProperties.woodcuttingrequiresaxe)
|
|
||||||
{
|
|
||||||
if(ItemChecks.isAxe(inhand)){
|
|
||||||
event.setInstaBreak(true);
|
|
||||||
WoodCutting.leafBlower(player, block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(inhand.getTypeId() != 359)
|
|
||||||
{
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
WoodCutting.leafBlower(player, block);
|
WoodCutting.leafBlower(player, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class Herbalism
|
|||||||
public static void greenTerra(Player player, Block block){
|
public static void greenTerra(Player player, Block block){
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||||
if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT){
|
if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT || block.getType() == Material.SMOOTH_BRICK){
|
||||||
if(!hasSeeds)
|
if(!hasSeeds)
|
||||||
player.sendMessage("You need more seeds to spread Green Terra");
|
player.sendMessage("You need more seeds to spread Green Terra");
|
||||||
if(hasSeeds && block.getType() != Material.WHEAT)
|
if(hasSeeds && block.getType() != Material.WHEAT)
|
||||||
|
@ -4,6 +4,7 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -305,4 +306,39 @@ public class Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean triggerCheck(Player player, Block block, AbilityType ability) {
|
||||||
|
boolean activate = true;
|
||||||
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
|
if (!ability.getPermissions(player)) {
|
||||||
|
activate = false;
|
||||||
|
return activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ability.equals(AbilityType.LEAF_BLOWER)) {
|
||||||
|
if (!ability.getMode(PP)) {
|
||||||
|
activate = false;
|
||||||
|
return activate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (ability) {
|
||||||
|
case BERSERK:
|
||||||
|
case GIGA_DRILL_BREAKER:
|
||||||
|
case SUPER_BREAKER:
|
||||||
|
case LEAF_BLOWER:
|
||||||
|
if (!m.blockBreakSimulate(block, player, true)) {
|
||||||
|
activate = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!ability.blockCheck(block)) {
|
||||||
|
activate = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return activate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user