mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Removed lingering traces of old block tracking method.
This commit is contained in:
parent
ebc87f46f7
commit
71d47eacaa
@ -148,10 +148,10 @@ public class mcBlockListener implements Listener {
|
||||
|
||||
if (mcPermissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) {
|
||||
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
|
||||
Mining.miningBlockCheck(player, block, plugin);
|
||||
Mining.miningBlockCheck(player, block);
|
||||
}
|
||||
else if (!LoadProperties.miningrequirespickaxe) {
|
||||
Mining.miningBlockCheck(player, block, plugin);
|
||||
Mining.miningBlockCheck(player, block);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,15 +161,15 @@ public class mcBlockListener implements Listener {
|
||||
|
||||
if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) {
|
||||
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
|
||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||
WoodCutting.woodcuttingBlockCheck(player, block);
|
||||
}
|
||||
else if (!LoadProperties.woodcuttingrequiresaxe) {
|
||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||
WoodCutting.woodcuttingBlockCheck(player, block);
|
||||
}
|
||||
}
|
||||
|
||||
if (PP.getTreeFellerMode() && mcPermissions.getInstance().woodCuttingAbility(player)) {
|
||||
WoodCutting.treeFeller(event, plugin);
|
||||
WoodCutting.treeFeller(event);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -261,11 +261,11 @@ public class mcBlockListener implements Listener {
|
||||
else if (PP.getSuperBreakerMode() && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
|
||||
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||
Mining.SuperBreakerBlockCheck(player, block);
|
||||
}
|
||||
else if (!LoadProperties.miningrequirespickaxe) {
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||
Mining.SuperBreakerBlockCheck(player, block);
|
||||
}
|
||||
}
|
||||
else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && mat.equals(Material.LEAVES)) {
|
||||
|
@ -126,7 +126,7 @@ public class mcEntityListener implements Listener {
|
||||
Wolf wolf = (Wolf) entity;
|
||||
|
||||
if ((!m.isInvincible(wolf, event)) && wolf.isTamed() && (wolf.getOwner() instanceof Player)) {
|
||||
Taming.preventDamage(event, plugin);
|
||||
Taming.preventDamage(event);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -202,7 +202,7 @@ public class mcEntityListener implements Listener {
|
||||
|
||||
if (plugin.misc.tntTracker.containsKey(id)) {
|
||||
Player player = plugin.misc.tntTracker.get(id);
|
||||
BlastMining.dropProcessing(player, event, plugin);
|
||||
BlastMining.dropProcessing(player, event);
|
||||
plugin.misc.tntTracker.remove(id);
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,9 @@ public class BlastMining {
|
||||
* @param oreBonus Percentage bonus for ore drops
|
||||
* @param debrisReduction Percentage reduction for non-ore drops
|
||||
* @param extraDrops Number of times to drop each block
|
||||
* @param plugin mcMMO plugin instance
|
||||
* @return A list of blocks dropped from the explosion
|
||||
*/
|
||||
private static List<Block> explosionYields(List<Block> ores, List<Block> debris, float yield, float oreBonus, float debrisReduction, int extraDrops, mcMMO plugin) {
|
||||
private static List<Block> explosionYields(List<Block> ores, List<Block> debris, float yield, float oreBonus, float debrisReduction, int extraDrops) {
|
||||
Iterator<Block> iterator2 = ores.iterator();
|
||||
List<Block> blocksDropped = new ArrayList<Block>();
|
||||
|
||||
@ -80,9 +79,8 @@ public class BlastMining {
|
||||
*
|
||||
* @param player Player triggering the explosion
|
||||
* @param event Event whose explosion is being processed
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void dropProcessing(Player player, EntityExplodeEvent event, mcMMO plugin) {
|
||||
public static void dropProcessing(Player player, EntityExplodeEvent event) {
|
||||
final int RANK_1_LEVEL = 125;
|
||||
final int RANK_2_LEVEL = 250;
|
||||
final int RANK_3_LEVEL = 375;
|
||||
@ -121,42 +119,42 @@ public class BlastMining {
|
||||
|
||||
//Triple Drops, No debris, +70% ores
|
||||
if (skillLevel >= RANK_8_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .70f, .30f, 3, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .70f, .30f, 3);
|
||||
}
|
||||
|
||||
//Triple Drops, No debris, +65% ores
|
||||
else if (skillLevel >= RANK_7_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .65f, .30f, 3, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .65f, .30f, 3);
|
||||
}
|
||||
|
||||
//Double Drops, No Debris, +60% ores
|
||||
else if (skillLevel >= RANK_6_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .60f, .30f, 2, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .60f, .30f, 2);
|
||||
}
|
||||
|
||||
//Double Drops, No Debris, +55% ores
|
||||
else if (skillLevel >= RANK_5_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .55f, .30f, 2, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .55f, .30f, 2);
|
||||
}
|
||||
|
||||
//No debris, +50% ores
|
||||
else if (skillLevel >= RANK_4_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .50f, .30f, 1, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .50f, .30f, 1);
|
||||
}
|
||||
|
||||
//No debris, +45% ores
|
||||
else if (skillLevel >= RANK_3_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .45f, .30f, 1, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .45f, .30f, 1);
|
||||
}
|
||||
|
||||
//+40% ores, -20% debris
|
||||
else if (skillLevel >= RANK_2_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .40f, .20f, 1, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .40f, .20f, 1);
|
||||
}
|
||||
|
||||
//+35% ores, -10% debris
|
||||
else if (skillLevel >= RANK_1_LEVEL) {
|
||||
xp = explosionYields(ores, debris, yield, .35f, .10f, 1, plugin);
|
||||
xp = explosionYields(ores, debris, yield, .35f, .10f, 1);
|
||||
}
|
||||
|
||||
for (Block block : xp) {
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
@ -153,9 +152,8 @@ public class Mining
|
||||
*
|
||||
* @param player The player mining the block
|
||||
* @param block The block being broken
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void miningBlockCheck(Player player, Block block, mcMMO plugin) {
|
||||
public static void miningBlockCheck(Player player, Block block) {
|
||||
if (block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
return;
|
||||
}
|
||||
@ -212,9 +210,8 @@ public class Mining
|
||||
*
|
||||
* @param player The player using the ability
|
||||
* @param block The block being affected
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin) {
|
||||
public static void SuperBreakerBlockCheck(Player player, Block block) {
|
||||
Material type = block.getType();
|
||||
int tier = m.getTier(player.getItemInHand());
|
||||
int durabilityLoss = LoadProperties.abilityDurabilityLoss;
|
||||
@ -258,8 +255,8 @@ public class Mining
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
|
||||
|
||||
miningBlockCheck(player, block, plugin);
|
||||
miningBlockCheck(player, block, plugin);
|
||||
miningBlockCheck(player, block);
|
||||
miningBlockCheck(player, block);
|
||||
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
|
@ -117,9 +117,8 @@ public class Taming {
|
||||
* Prevent damage to wolves based on various skills.
|
||||
*
|
||||
* @param event The event to modify
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void preventDamage(EntityDamageEvent event, mcMMO plugin) {
|
||||
public static void preventDamage(EntityDamageEvent event) {
|
||||
final int ENVIRONMENTALLY_AWARE_LEVEL = 100;
|
||||
final int THICK_FUR_LEVEL = 250;
|
||||
final int SHOCK_PROOF_LEVEL = 500;
|
||||
|
@ -13,20 +13,22 @@ import org.bukkit.Bukkit;
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.config.*;
|
||||
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
|
||||
public class WoodCutting {
|
||||
|
||||
public class WoodCutting
|
||||
{
|
||||
public static void treeFeller(BlockBreakEvent event, mcMMO plugin)
|
||||
{
|
||||
/**
|
||||
* Handle the Tree Feller ability.
|
||||
*
|
||||
* @param event Event to modify
|
||||
*/
|
||||
public static void treeFeller(BlockBreakEvent event) {
|
||||
//Setup vars
|
||||
Player player = event.getPlayer();
|
||||
Block firstBlock = event.getBlock();
|
||||
@ -36,11 +38,11 @@ public class WoodCutting
|
||||
ArrayList<Block> toBeFelled = new ArrayList<Block>();
|
||||
|
||||
//NOTE: Tree Feller will cut upwards like how you actually fell trees
|
||||
processTreeFelling(firstBlock, toBeFelled, plugin);
|
||||
removeBlocks(toBeFelled, player, PP, plugin);
|
||||
processTreeFelling(firstBlock, toBeFelled);
|
||||
removeBlocks(toBeFelled, player, PP);
|
||||
}
|
||||
|
||||
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP, mcMMO plugin)
|
||||
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP)
|
||||
{
|
||||
if(toBeFelled.size() > LoadProperties.treeFellerThreshold)
|
||||
{
|
||||
@ -147,7 +149,7 @@ public class WoodCutting
|
||||
return block.getType() == Material.LOG || block.getType() == Material.LEAVES || block.getType() == Material.AIR;
|
||||
}
|
||||
|
||||
private static void processTreeFelling(Block currentBlock, ArrayList<Block> toBeFelled, mcMMO plugin)
|
||||
private static void processTreeFelling(Block currentBlock, ArrayList<Block> toBeFelled)
|
||||
{
|
||||
|
||||
if(currentBlock.getType() == Material.LOG || currentBlock.getType() == Material.LEAVES)
|
||||
@ -163,16 +165,16 @@ public class WoodCutting
|
||||
|
||||
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") &&
|
||||
!isTooAgressive(isAirOrLeaves, xPositive) && treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive))
|
||||
processTreeFelling(xPositive, toBeFelled, plugin);
|
||||
processTreeFelling(xPositive, toBeFelled);
|
||||
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") &&
|
||||
!isTooAgressive(isAirOrLeaves, xNegative) && treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative))
|
||||
processTreeFelling(xNegative, toBeFelled, plugin);
|
||||
processTreeFelling(xNegative, toBeFelled);
|
||||
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") &&
|
||||
!isTooAgressive(isAirOrLeaves, zPositive) && treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive))
|
||||
processTreeFelling(zPositive, toBeFelled, plugin);
|
||||
processTreeFelling(zPositive, toBeFelled);
|
||||
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") &&
|
||||
!isTooAgressive(isAirOrLeaves, zNegative) && treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative))
|
||||
processTreeFelling(zNegative, toBeFelled, plugin);
|
||||
processTreeFelling(zNegative, toBeFelled);
|
||||
|
||||
//Finally go Y+
|
||||
Block yPositive = currentBlock.getRelative(0, 1, 0);
|
||||
@ -181,7 +183,7 @@ public class WoodCutting
|
||||
{
|
||||
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") && !toBeFelled.contains(yPositive))
|
||||
{
|
||||
processTreeFelling(yPositive, toBeFelled, plugin);
|
||||
processTreeFelling(yPositive, toBeFelled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -206,7 +208,7 @@ public class WoodCutting
|
||||
}
|
||||
}
|
||||
|
||||
public static void woodcuttingBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
public static void woodcuttingBlockCheck(Player player, Block block)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int xp = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user