Fix Ender Pearls not preventing XP gains in offhand

This commit is contained in:
nossr50 2019-07-07 01:55:23 -07:00
parent ec44c99076
commit 67a687ee40
6 changed files with 16 additions and 9 deletions

View File

@ -1,17 +1,20 @@
Version 2.1.95
Added missing Chorus_Fruit & Chorus_Plant entries to Herbalism's Bonus Drops in config.yml (See notes)
Added 'Carrots, Cocoa, Potatoes, Wheat, Beetroots, Nether_Wart' to Herbalism in experience.yml (See notes)
Fixed a bug preventing Wandering Traders from granting XP
Fixed a bug that prevented Chorus Tree's from giving full XP if you broke anything other than the bottom block
Fixed a bug which could cause Large Fern's to reward less XP
Fixed a bug where certain herbalism crops could have fewer than intended bonus drops
Added missing 'Chorus_Flower' entry to herbalism in experience.yml (update your config manually or delete the file to regenerate it)
Fixed a bug involving Ender Pearl and Acrobatics
Added 'Carrots, Cocoa, Potatoes, Wheat, Beetroots, Nether_Wart' to Herbalism in experience.yml (See notes)
Removed the _Ripe entries from experience.yml (no longer used)
Added missing 'Chorus_Flower' entry to herbalism in experience.yml
Added some debug messages about XP gains if you are in debug mode
Added some debug messages for Acrobatics if you are in debug mode
Added some debug messages for Herbalism if you are in debug mode
NOTES:
Add 'Chorus_Fruit' and 'Chorus_Plant' under Bonus_Drops.Herbalism in config.yml or you will not be getting double drops for Chorus Fruit.
You shouldn't need to add "Carrots, Cocoa, Potatoes, Wheat, Beetroots, Nether_Wart" to your experience file, it seems that file updates automatically for missing entries.
You shouldn't need to add "Chorus_Flower, Carrots, Cocoa, Potatoes, Wheat, Beetroots, Nether_Wart" to your experience file, it seems that config file updates automatically for missing entries.
Version 2.1.94
2 new devs have joined the mcMMO team (electronicboy, kashike), bringing the active dev team to 3 including myself! Strings relating to authors of mcMMO have been updated to reflect this

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.95-SNAPSHOT</version>
<version>2.1.95</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
@ -276,7 +277,7 @@ public class Roll extends AcrobaticsSubSkill {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (player.getInventory().getItemInMainHand().getType() == Material.ENDER_PEARL || player.isInsideVehicle()) {
if (ItemUtils.hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
}

View File

@ -72,8 +72,6 @@ public class EntityListener implements Listener {
if(!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
return;
if(event.getReason() == EntityTargetEvent.TargetReason.TEMPT)
//It's rare but targets can be null sometimes
if(event.getTarget() == null)
{
@ -83,7 +81,7 @@ public class EntityListener implements Listener {
//Prevent entities from giving XP if they target endermite
if(event.getTarget() instanceof Endermite)
{
if(event.getEntity().getMetadata(mcMMO.entityMetadataKey) == null || event.getEntity().getMetadata(mcMMO.entityMetadataKey).size() <= 0)
if(event.getEntity().hasMetadata(mcMMO.entityMetadataKey))
event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
}
}
@ -189,6 +187,7 @@ public class EntityListener implements Listener {
if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) {
mcMMO.getPlaceStore().setFalse(block);
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
}
else if (isTracked) {

View File

@ -11,7 +11,6 @@ import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.util.random.RandomChanceSkill;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Ageable;
import org.bukkit.block.data.BlockData;

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
@ -32,6 +33,10 @@ public final class ItemUtils {
}
}
public static boolean hasItemInEitherHand(Player player, Material material) {
return player.getInventory().getItemInMainHand().getType() == material || player.getInventory().getItemInOffHand().getType() == material;
}
/**
* Checks if the item is a sword.
*