mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Fixes #3672, Fixes #3316, Fixes #3288, Fixes #2434, Fixes #1732, Fixes #1726, Fixes #1597, Fixes #941
This commit is contained in:
parent
6ce44b7ce8
commit
12af9af902
@ -60,6 +60,7 @@ Version 2.1.0
|
||||
= (MySQL) You can now inspect offline players
|
||||
= (MySQL) When converting from MySQL to flatfile mcMMO will now properly include all users in the conversion process
|
||||
+ (Party) Parties can now have size limits (configurable in config.yml), party size is unlimited by default
|
||||
! (Deaths) Fixed the bug where mob names would be replaced by hearts
|
||||
! (Experience) The XP values of fish are now based on their rarity and have been drastically changed
|
||||
! (Item) Improved some of the messages sent to the player regarding the Chimaera Wing
|
||||
! (Party) Party member list will only include members of the party that you can see (aren't vanished)
|
||||
|
15
src/main/java/com/gmail/nossr50/datatypes/meta/OldName.java
Normal file
15
src/main/java/com/gmail/nossr50/datatypes/meta/OldName.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.gmail.nossr50.datatypes.meta;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
/**
|
||||
* This class is for storing mob names since we switch them to heart values
|
||||
*/
|
||||
public class OldName extends FixedMetadataValue {
|
||||
|
||||
public OldName(String oldName, mcMMO plugin)
|
||||
{
|
||||
super(plugin, oldName);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.meta.OldName;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
|
||||
@ -36,10 +37,13 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
@ -223,7 +227,28 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
CombatUtils.processCombatAttack(event, attacker, target);
|
||||
CombatUtils.handleHealthbars(attacker, target, event.getFinalDamage());
|
||||
CombatUtils.handleHealthbars(attacker, target, event.getFinalDamage(), plugin);
|
||||
|
||||
/**
|
||||
* This sets entity names back to whatever they are supposed to be
|
||||
*/
|
||||
if(!(attacker instanceof Player) && defender instanceof Player)
|
||||
{
|
||||
if(event.getFinalDamage() >= ((LivingEntity) defender).getHealth())
|
||||
{
|
||||
List<MetadataValue> metadataValue = attacker.getMetadata("mcMMO_oldName");
|
||||
|
||||
if(metadataValue.size() <= 0)
|
||||
return;
|
||||
|
||||
if(metadataValue != null)
|
||||
{
|
||||
OldName oldName = (OldName) metadataValue.get(0);
|
||||
attacker.setCustomName(oldName.asString());
|
||||
attacker.setCustomNameVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,6 +319,7 @@ public class EntityListener implements Listener {
|
||||
if (event.getFinalDamage() >= 1) {
|
||||
mcMMOPlayer.actualizeRecentlyHurt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (livingEntity instanceof Tameable) {
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.util;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.meta.OldName;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
|
||||
@ -13,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
public final class MobHealthbarUtils {
|
||||
private MobHealthbarUtils() {}
|
||||
@ -38,7 +40,7 @@ public final class MobHealthbarUtils {
|
||||
* @param target the targetted entity
|
||||
* @param damage damage done by the attack triggering this
|
||||
*/
|
||||
public static void handleMobHealthbars(Player player, LivingEntity target, double damage) {
|
||||
public static void handleMobHealthbars(Player player, LivingEntity target, double damage, mcMMO plugin) {
|
||||
if (mcMMO.isHealthBarPluginEnabled() || !Permissions.mobHealthDisplay(player) || !Config.getInstance().getMobHealthbarEnabled()) {
|
||||
return;
|
||||
}
|
||||
@ -57,8 +59,16 @@ public final class MobHealthbarUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
String originalName = target.getName();
|
||||
String oldName = target.getCustomName();
|
||||
|
||||
|
||||
/*
|
||||
* Store the name in metadata
|
||||
*/
|
||||
if(target.getMetadata("mcMMO_oldName").size() <= 0 && originalName != null)
|
||||
target.setMetadata("mcMMO_oldName", new OldName(originalName, plugin));
|
||||
|
||||
if (oldName == null) {
|
||||
oldName = "";
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ public final class CombatUtils {
|
||||
return tier;
|
||||
}
|
||||
|
||||
public static void handleHealthbars(Entity attacker, LivingEntity target, double damage) {
|
||||
public static void handleHealthbars(Entity attacker, LivingEntity target, double damage, mcMMO plugin) {
|
||||
if (!(attacker instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
@ -718,6 +718,6 @@ public final class CombatUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
MobHealthbarUtils.handleMobHealthbars(player, target, damage);
|
||||
MobHealthbarUtils.handleMobHealthbars(player, target, damage, plugin);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user