Handle all the buff removal in BlockDamage. Also removes the config

option for using Mining & Excavation without tools.
This commit is contained in:
GJ 2013-02-16 11:28:19 -05:00
parent a9ed1a1850
commit 4071f259ad
9 changed files with 14 additions and 74 deletions

View File

@ -91,6 +91,7 @@ Version 1.4.00-dev
- Removed unused "healthbar" files from the resources - Removed unused "healthbar" files from the resources
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions. - Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
- Removed /mcc command. Replaced with /mcmmo [?|help|commands] - Removed /mcc command. Replaced with /mcmmo [?|help|commands]
- Removed options to allow Mining & Excavation without a tool due to the changes to their abilities
Version 1.3.14 Version 1.3.14
+ Added new Hylian Luck skill to Herbalism. + Added new Hylian Luck skill to Herbalism.

View File

@ -8,7 +8,6 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.McMMOPlayer; import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class McrefreshCommand implements CommandExecutor { public class McrefreshCommand implements CommandExecutor {
@ -33,7 +32,6 @@ public class McrefreshCommand implements CommandExecutor {
profile.resetCooldowns(); profile.resetCooldowns();
profile.resetToolPrepMode(); profile.resetToolPrepMode();
profile.resetAbilityMode(); profile.resetAbilityMode();
SkillTools.handleAbilitySpeedDecrease((Player) sender); //Remove enchants left over
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh")); sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
return true; return true;
@ -69,7 +67,6 @@ public class McrefreshCommand implements CommandExecutor {
profile.resetCooldowns(); profile.resetCooldowns();
profile.resetToolPrepMode(); profile.resetToolPrepMode();
profile.resetAbilityMode(); profile.resetAbilityMode();
SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh")); player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0])); sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));

View File

@ -150,8 +150,6 @@ public class Config extends ConfigLoader {
*/ */
/* Tool Requirements */ /* Tool Requirements */
public boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); }
public boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); }
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); } public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
/* Excavation */ /* Excavation */

View File

@ -30,7 +30,6 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.runnables.StickyPistonTracker; import com.gmail.nossr50.runnables.StickyPistonTracker;
import com.gmail.nossr50.skills.excavation.Excavation; import com.gmail.nossr50.skills.excavation.Excavation;
import com.gmail.nossr50.skills.herbalism.Herbalism; import com.gmail.nossr50.skills.herbalism.Herbalism;
import com.gmail.nossr50.skills.mining.Mining;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.repair.Salvage;
@ -169,9 +168,7 @@ public class BlockListener implements Listener {
} }
/* MINING */ /* MINING */
else if (BlockChecks.canBeSuperBroken(block) && player.hasPermission("mcmmo.skills.mining") && !mcMMO.placeStore.isTrue(block)) { else if (BlockChecks.canBeSuperBroken(block) && ItemChecks.isPickaxe(heldItem) && player.hasPermission("mcmmo.skills.mining") && !mcMMO.placeStore.isTrue(block)) {
if (Mining.requiresTool) {
if (ItemChecks.isPickaxe(heldItem)) {
MiningManager miningManager = new MiningManager(mcMMOPlayer); MiningManager miningManager = new MiningManager(mcMMOPlayer);
miningManager.miningBlockCheck(block); miningManager.miningBlockCheck(block);
@ -179,16 +176,6 @@ public class BlockListener implements Listener {
miningManager.miningBlockCheck(block); miningManager.miningBlockCheck(block);
} }
} }
}
else {
MiningManager miningManager = new MiningManager(mcMMOPlayer);
miningManager.miningBlockCheck(block);
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
miningManager.miningBlockCheck(block);
}
}
}
/* WOOD CUTTING */ /* WOOD CUTTING */
else if (BlockChecks.isLog(block) && player.hasPermission("mcmmo.skills.woodcutting") && !mcMMO.placeStore.isTrue(block)) { else if (BlockChecks.isLog(block) && player.hasPermission("mcmmo.skills.woodcutting") && !mcMMO.placeStore.isTrue(block)) {
@ -208,24 +195,13 @@ public class BlockListener implements Listener {
} }
/* EXCAVATION */ /* EXCAVATION */
else if (BlockChecks.canBeGigaDrillBroken(block) && player.hasPermission("mcmmo.skills.excavation") && !mcMMO.placeStore.isTrue(block)) { else if (BlockChecks.canBeGigaDrillBroken(block) && ItemChecks.isShovel(heldItem) && player.hasPermission("mcmmo.skills.excavation") && !mcMMO.placeStore.isTrue(block)) {
if (Excavation.requiresTool) {
if (ItemChecks.isShovel(heldItem)) {
Excavation.excavationProcCheck(block, mcMMOPlayer); Excavation.excavationProcCheck(block, mcMMOPlayer);
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) { if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
Excavation.gigaDrillBreaker(mcMMOPlayer, block); Excavation.gigaDrillBreaker(mcMMOPlayer, block);
} }
} }
}
else {
Excavation.excavationProcCheck(block, mcMMOPlayer);
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
Excavation.gigaDrillBreaker(mcMMOPlayer, block);
}
}
}
/* Remove metadata from placed watched blocks */ /* Remove metadata from placed watched blocks */
if (BlockChecks.shouldBeWatched(block) && mcMMO.placeStore.isTrue(block)) { if (BlockChecks.shouldBeWatched(block) && mcMMO.placeStore.isTrue(block)) {
@ -290,6 +266,10 @@ public class BlockListener implements Listener {
if (BlockChecks.canActivateAbilities(block)) { if (BlockChecks.canActivateAbilities(block)) {
ItemStack heldItem = player.getItemInHand(); ItemStack heldItem = player.getItemInHand();
if ((ItemChecks.isPickaxe(heldItem) && !profile.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemChecks.isShovel(heldItem) && !profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
SkillTools.removeAbilityBuff(heldItem);
}
if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) { if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) {
SkillTools.abilityCheck(player, SkillType.HERBALISM); SkillTools.abilityCheck(player, SkillType.HERBALISM);
} }

View File

@ -10,7 +10,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.inventory.FurnaceBurnEvent; import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceExtractEvent; import org.bukkit.event.inventory.FurnaceExtractEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent; import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
@ -20,7 +19,6 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.McMMOPlayer; import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.skills.smelting.SmeltingManager; import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.util.ItemChecks; import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -130,10 +128,4 @@ public class InventoryListener implements Listener{
} }
} }
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInventoryClickEvent(InventoryClickEvent event) {
ItemStack item = event.getCurrentItem();
SkillTools.removeAbilityBuff(item); //Remove enchants if they try to move them in an inventory
}
} }

View File

@ -58,28 +58,6 @@ public class PlayerListener implements Listener {
this.plugin = plugin; this.plugin = plugin;
} }
/**
* Handle PlayerDeath events where the event is modified.
*
* @param event The event to modify
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerDeathHigher(PlayerDeathEvent event) {
Player player = event.getEntity();
if (Misc.isNPCPlayer(player)) {
return;
}
PlayerProfile playerProfile = Users.getPlayer(player).getProfile();
if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
for (ItemStack item : event.getDrops()) {
SkillTools.removeAbilityBuff(item);
}
}
}
/** /**
* Monitor PlayerDeath events. * Monitor PlayerDeath events.
* *
@ -245,8 +223,6 @@ public class PlayerListener implements Listener {
if (plugin.isXPEventEnabled()) { if (plugin.isXPEventEnabled()) {
player.sendMessage(LocaleLoader.getString("XPRate.Event", Config.getInstance().getExperienceGainsGlobalMultiplier())); player.sendMessage(LocaleLoader.getString("XPRate.Event", Config.getInstance().getExperienceGainsGlobalMultiplier()));
} }
SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over in case of disconnect or server crash
} }
/** /**

View File

@ -19,7 +19,6 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
public class Excavation { public class Excavation {
public static boolean requiresTool = Config.getInstance().getExcavationRequiresTool();
/** /**
* Check to see if treasures were found. * Check to see if treasures were found.

View File

@ -24,7 +24,6 @@ public class Mining {
public static double doubleDropsMaxChance = advancedConfig.getMiningDoubleDropChance(); public static double doubleDropsMaxChance = advancedConfig.getMiningDoubleDropChance();
public static boolean doubleDropsDisabled = config.miningDoubleDropsDisabled(); public static boolean doubleDropsDisabled = config.miningDoubleDropsDisabled();
public static boolean requiresTool = Config.getInstance().getMiningRequiresTool();
public static final int DIAMOND_TOOL_TIER = 4; public static final int DIAMOND_TOOL_TIER = 4;
public static final int IRON_TOOL_TIER = 3; public static final int IRON_TOOL_TIER = 3;

View File

@ -140,7 +140,6 @@ Skills:
Level_Cap: 0 Level_Cap: 0
Excavation: Excavation:
Level_Cap: 0 Level_Cap: 0
Requires_Shovel: true
Fishing: Fishing:
Drops_Enabled: true Drops_Enabled: true
Level_Cap: 0 Level_Cap: 0
@ -154,7 +153,6 @@ Skills:
Dirt_To_Grass: true Dirt_To_Grass: true
Mining: Mining:
Level_Cap: 0 Level_Cap: 0
Requires_Pickaxe: true
Detonator_ID: 259 Detonator_ID: 259
Repair: Repair:
Level_Cap: 0 Level_Cap: 0