mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed exploit where you could gain tons of Acrobatics XP from spamming
Ender Pearls
This commit is contained in:
parent
f9e5096ceb
commit
41c9741b72
@ -10,6 +10,7 @@ Key:
|
||||
Version 1.3.08
|
||||
+ Added new hidden.yml inside the jar for very sensitive config options for advanced users
|
||||
+ Added option to disable Chunklets for servers which do not have doubledrops and do not care about xp farming
|
||||
= Fixed exploit where you could gain tons of Acrobatics XP from spamming Ender Pearls
|
||||
! Changed Mining to allow Silk Touch to work again since the dupe exploit has been fixed.
|
||||
|
||||
Version 1.3.07
|
||||
|
@ -123,7 +123,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
if (!Misc.isInvincible(player, event)) {
|
||||
if (cause == DamageCause.FALL && Permissions.getInstance().acrobatics(player) && !player.isInsideVehicle()) {
|
||||
if (cause == DamageCause.FALL && Permissions.getInstance().acrobatics(player) && !player.isInsideVehicle() && !player.getItemInHand().getType().equals(Material.ENDER_PEARL)) {
|
||||
Acrobatics.acrobaticsCheck(player, event);
|
||||
}
|
||||
else if (cause == DamageCause.BLOCK_EXPLOSION && Permissions.getInstance().demolitionsExpertise(player)) {
|
||||
|
@ -19,13 +19,11 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
|
||||
public class Mining {
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
/**
|
||||
@ -88,7 +86,7 @@ public class Mining {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
if (ModChecks.isCustomMiningBlock(block)) {
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
break;
|
||||
@ -197,7 +195,7 @@ public class Mining {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
if (ModChecks.isCustomMiningBlock(block)) {
|
||||
item = ModChecks.getCustomBlock(block).getItemDrop();
|
||||
Misc.dropItem(loc, item);
|
||||
}
|
||||
@ -271,7 +269,7 @@ public class Mining {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
if (ModChecks.isCustomMiningBlock(block)) {
|
||||
xp += ModChecks.getCustomBlock(block).getXpGain();
|
||||
}
|
||||
break;
|
||||
@ -295,10 +293,10 @@ public class Mining {
|
||||
miningXP(player, block);
|
||||
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().miningDoubleDrops(player)) {
|
||||
if (random.nextInt(1000) <= skillCheck && Permissions.getInstance().miningDoubleDrops(player)) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
silkTouchDrops(block);
|
||||
}
|
||||
@ -320,7 +318,7 @@ public class Mining {
|
||||
int durabilityLoss = Config.getInstance().getAbilityToolDamage();
|
||||
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
|
||||
|
||||
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
if (ModChecks.isCustomMiningBlock(block)) {
|
||||
if (ModChecks.getCustomBlock(block).getTier() < tier) {
|
||||
return;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class Acrobatics {
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@ public class ModChecks {
|
||||
private static Config configInstance = Config.getInstance();
|
||||
private static boolean customToolsEnabled = configInstance.getToolModsEnabled();
|
||||
private static boolean customArmorEnabled = configInstance.getArmorModsEnabled();
|
||||
private static boolean customBlocksEnabled = configInstance.getBlockModsEnabled();
|
||||
|
||||
private static CustomToolsConfig toolInstance = CustomToolsConfig.getInstance();
|
||||
private static CustomArmorConfig armorInstance = CustomArmorConfig.getInstance();
|
||||
@ -60,6 +61,21 @@ public class ModChecks {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom block is a custom block.
|
||||
*
|
||||
* @param block The block to check
|
||||
* @return true if the block is custom, false otherwise
|
||||
*/
|
||||
public static boolean isCustomMiningBlock(Block block) {
|
||||
if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom block is a leaf block.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user