Fixed a taming NPE

This commit is contained in:
nossr50 2020-08-25 14:10:53 -07:00
parent b35c58ec21
commit 8807d6c216
7 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,9 @@
Version 2.1.144
Fixed a NPE that would happen involving taming in combat processing
Updated hu_HU locale (thanks andris155)
Version 2.1.143
mcMMO now tracks super ability boosted items through persistent metadata
mcMMO no longer relies on lore to tell if an item has been modified by a super ability

View File

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

View File

@ -72,7 +72,9 @@ public class InventoryListener implements Listener {
return;
}
Bukkit.broadcastMessage("Debug: Modifying burn time from - "+event.getBurnTime());
event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
Bukkit.broadcastMessage("Debug: New burn time "+event.getBurnTime());
}
}

View File

@ -5,8 +5,8 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.compat.layers.attackcooldown.PlayerAttackCooldownExploitPreventionLayer;
import com.gmail.nossr50.util.compat.layers.persistentdata.AbstractPersistentDataLayer;
import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer;
import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotTemporaryDataLayer;
import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer_1_14;
import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer_1_13;
import com.gmail.nossr50.util.nms.NMSVersion;
import com.gmail.nossr50.util.platform.MinecraftGameVersion;
import org.bukkit.command.CommandSender;
@ -67,10 +67,10 @@ public class CompatibilityManager {
private void initPersistentDataLayer() {
if(minecraftGameVersion.getMinorVersion().asInt() >= 14 || minecraftGameVersion.getMajorVersion().asInt() >= 2) {
persistentDataLayer = new SpigotPersistentDataLayer();
persistentDataLayer = new SpigotPersistentDataLayer_1_14();
} else {
persistentDataLayer = new SpigotTemporaryDataLayer();
persistentDataLayer = new SpigotPersistentDataLayer_1_13();
}
supportedLayers.put(CompatibilityType.PERSISTENT_DATA, true);

View File

@ -16,7 +16,7 @@ import java.util.UUID;
/**
* Persistent Data API is unavailable
*/
public class SpigotTemporaryDataLayer extends AbstractPersistentDataLayer {
public class SpigotPersistentDataLayer_1_13 extends AbstractPersistentDataLayer {
private final String FURNACE_OWNER_METADATA_KEY = "mcMMO_furnace_owner";

View File

@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class SpigotPersistentDataLayer extends AbstractPersistentDataLayer {
public class SpigotPersistentDataLayer_1_14 extends AbstractPersistentDataLayer {
/*
* Don't modify these keys

View File

@ -414,6 +414,10 @@ public final class CombatUtils {
if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntityExcludingVillagers(player) && PrimarySkillType.TAMING.getPermissions(player)) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null)
return;
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
tamingManager.attackTarget(target);
}