mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Check mining rank before processing double drops
This commit is contained in:
parent
421d6cff3b
commit
d9b84b0ab3
@ -15,7 +15,7 @@ Version 2.1.89
|
|||||||
When using WorldGuard (WG) with mcMMO, mcMMO now examines WG more carefully to determine if it is a compatible version or not, see the notes. Keep in mind WG is optional and not needed to run mcMMO.
|
When using WorldGuard (WG) with mcMMO, mcMMO now examines WG more carefully to determine if it is a compatible version or not, see the notes. Keep in mind WG is optional and not needed to run mcMMO.
|
||||||
Fixed a bug that could result in Tree Feller failing to remove parts of a tree in snowy biomes. (This fix won't apply retroactively to old trees, see the notes)
|
Fixed a bug that could result in Tree Feller failing to remove parts of a tree in snowy biomes. (This fix won't apply retroactively to old trees, see the notes)
|
||||||
Updated Japanese locale (thanks snake)
|
Updated Japanese locale (thanks snake)
|
||||||
Tree Feller and other Super Abilities will damage tools with the Enchantment named 'Durability/Unbreaking' again, this does not apply to the NBT tag named Unbreaking (Unbreaking NBT tag is safe from damage however, try not to confuse them as they share the same name)
|
Tree Feller and other Super Abilities will damage tools with the Enchantment named 'Durability/Unbreaking' again, this does not apply to the NBT tag named Ubreakable (Unbreakable NBT tag is safe from damage however, try not to confuse them as they share similar names)
|
||||||
Added new setting 'ExploitFix.TreeFellerReducedXP' to experience.yml
|
Added new setting 'ExploitFix.TreeFellerReducedXP' to experience.yml
|
||||||
Tree Feller will no longer give full XP for each block destroyed and instead give diminishing returns on XP for each block removed. You can turn this off by setting 'ExploitFix.TreeFellerReducedXP' in experience.yml to false
|
Tree Feller will no longer give full XP for each block destroyed and instead give diminishing returns on XP for each block removed. You can turn this off by setting 'ExploitFix.TreeFellerReducedXP' in experience.yml to false
|
||||||
Many skills which used to unlock at level 5/50 now unlock at level 1 instead
|
Many skills which used to unlock at level 5/50 now unlock at level 1 instead
|
||||||
@ -58,7 +58,7 @@ Version 2.1.89
|
|||||||
|
|
||||||
Archaeology does something now, it will be tweaked again in the future. Previously rank 1 of Archaeology was required to find treasures but that was all it did, now each rank of Archaeology also adds a small chance to find experience orbs when a player finds treasure.
|
Archaeology does something now, it will be tweaked again in the future. Previously rank 1 of Archaeology was required to find treasures but that was all it did, now each rank of Archaeology also adds a small chance to find experience orbs when a player finds treasure.
|
||||||
|
|
||||||
In a prior patch I removed damage on tools if they had Unbreaking NBT or Unbreaking Enchantment, at the time I made this change I did not realize they were different things and just shared the same name, this patch fixes this mistake. My intention was to prevent damage on tools with the NBT unbreaking tag which makes an item never suffer from durability loss.
|
In a prior patch I removed damage on tools if they had Unbreakable NBT or Unbreaking Enchantment, at the time I made this change I did not realize they were different things and just shared the same name, this patch fixes this mistake. My intention was to prevent damage on tools with the NBT unbreakable tag which makes an item never suffer from durability loss.
|
||||||
mcMMO reduces damage to tools from super abilities if they have the "Durability/Unbreaking" enchantment already, this behaviour has been in mcMMO for a long time.
|
mcMMO reduces damage to tools from super abilities if they have the "Durability/Unbreaking" enchantment already, this behaviour has been in mcMMO for a long time.
|
||||||
|
|
||||||
Tree Feller will now give reduced XP per block destroyed by Tree Feller and will never go below 1 XP per block, you can turn this off with 'ExploitFix.TreeFellerReducedXP' in experience.yml
|
Tree Feller will now give reduced XP per block destroyed by Tree Feller and will never go below 1 XP per block, you can turn this off with 'ExploitFix.TreeFellerReducedXP' in experience.yml
|
||||||
|
@ -72,7 +72,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
||||||
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
||||||
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
||||||
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkillType.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = canUseSubskill(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||||
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
|||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
@ -32,10 +32,12 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.event.*;
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
@ -45,7 +45,6 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
|||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
@ -311,12 +310,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public void onLoad()
|
public void onLoad()
|
||||||
{
|
{
|
||||||
if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||||
//Make sure WG is compatible before proceeding
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
|
||||||
WorldGuardManager.getInstance().registerFlags();
|
WorldGuardManager.getInstance().registerFlags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Things to be run when the plugin is disabled.
|
* Things to be run when the plugin is disabled.
|
||||||
@ -338,6 +334,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
placeStore.saveAll(); // Save our metadata
|
placeStore.saveAll(); // Save our metadata
|
||||||
placeStore.cleanUp(); // Cleanup empty metadata stores
|
placeStore.cleanUp(); // Cleanup empty metadata stores
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e) { e.printStackTrace(); }
|
catch (Exception e) { e.printStackTrace(); }
|
||||||
|
|
||||||
debug("Canceling all tasks...");
|
debug("Canceling all tasks...");
|
||||||
|
@ -59,6 +59,10 @@ public class MiningManager extends SkillManager {
|
|||||||
return getSkillLevel() >= BlastMining.getBiggerBombsUnlockLevel() && Permissions.biggerBombs(getPlayer());
|
return getSkillLevel() >= BlastMining.getBiggerBombsUnlockLevel() && Permissions.biggerBombs(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canDoubleDrop() {
|
||||||
|
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process double drops & XP gain for Mining.
|
* Process double drops & XP gain for Mining.
|
||||||
*
|
*
|
||||||
@ -77,7 +81,7 @@ public class MiningManager extends SkillManager {
|
|||||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType()))
|
if(!Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType()) || !canDoubleDrop())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean silkTouch = player.getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
boolean silkTouch = player.getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
||||||
|
@ -11,7 +11,10 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.woodcutting;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
@ -6,7 +6,6 @@ import com.sk89q.worldguard.WorldGuard;
|
|||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
|
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
|
||||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
|
||||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -16,13 +15,6 @@ import static org.bukkit.Bukkit.getServer;
|
|||||||
public class WorldGuardManager {
|
public class WorldGuardManager {
|
||||||
private static WorldGuardManager instance;
|
private static WorldGuardManager instance;
|
||||||
private WorldGuardPlugin worldGuardPluginRef;
|
private WorldGuardPlugin worldGuardPluginRef;
|
||||||
private RegionContainer container;
|
|
||||||
|
|
||||||
public WorldGuardManager() {
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
|
||||||
container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorldGuardManager getInstance() {
|
public static WorldGuardManager getInstance() {
|
||||||
if(instance == null)
|
if(instance == null)
|
||||||
@ -40,7 +32,7 @@ public class WorldGuardManager {
|
|||||||
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
|
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
|
||||||
|
|
||||||
//WorldGuardPlugin worldGuard = getWorldGuard();
|
//WorldGuardPlugin worldGuard = getWorldGuard();
|
||||||
RegionQuery query = container.createQuery();
|
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||||
|
|
||||||
//ApplicableRegionSet set = query.getApplicableRegions(loc);
|
//ApplicableRegionSet set = query.getApplicableRegions(loc);
|
||||||
|
|
||||||
@ -56,7 +48,7 @@ public class WorldGuardManager {
|
|||||||
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
|
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
|
||||||
|
|
||||||
//WorldGuardPlugin worldGuard = getWorldGuard();
|
//WorldGuardPlugin worldGuard = getWorldGuard();
|
||||||
RegionQuery query = container.createQuery();
|
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||||
|
|
||||||
//ApplicableRegionSet set = query.getApplicableRegions(loc);
|
//ApplicableRegionSet set = query.getApplicableRegions(loc);
|
||||||
|
|
||||||
@ -72,7 +64,7 @@ public class WorldGuardManager {
|
|||||||
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
|
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
|
||||||
|
|
||||||
//WorldGuardPlugin worldGuard = getWorldGuard();
|
//WorldGuardPlugin worldGuard = getWorldGuard();
|
||||||
RegionQuery query = container.createQuery();
|
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||||
|
|
||||||
//ApplicableRegionSet set = query.getApplicableRegions(loc);
|
//ApplicableRegionSet set = query.getApplicableRegions(loc);
|
||||||
|
|
||||||
@ -93,10 +85,8 @@ public class WorldGuardManager {
|
|||||||
|
|
||||||
public void registerFlags()
|
public void registerFlags()
|
||||||
{
|
{
|
||||||
if(getWorldGuard() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// register our flag with the registry
|
// register our flag with the registry
|
||||||
registry.register(WorldGuardFlags.MCMMO_ENABLE_WG_FLAG);
|
registry.register(WorldGuardFlags.MCMMO_ENABLE_WG_FLAG);
|
||||||
|
@ -43,7 +43,7 @@ public class WorldGuardUtils {
|
|||||||
if(detectedIncompatibleWG)
|
if(detectedIncompatibleWG)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WorldGuardPlugin worldGuardPlugin = getWorldGuard();
|
worldGuardPluginRef = getWorldGuard();
|
||||||
|
|
||||||
return isLoaded;
|
return isLoaded;
|
||||||
}
|
}
|
||||||
@ -104,12 +104,12 @@ public class WorldGuardUtils {
|
|||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
mcMMO.p.getLogger().severe("Missing WorldGuard class - "+classString);
|
mcMMO.p.getLogger().severe("Missing WorldGuard class - "+classString);
|
||||||
markWGIncompatible();
|
markWGIncompatible();
|
||||||
break; //Break out of the loop
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return detectedIncompatibleWG;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user