Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into configurable

This commit is contained in:
nossr50
2019-05-14 23:01:05 -07:00
13 changed files with 135 additions and 43 deletions

View File

@@ -35,6 +35,15 @@ public final class BlockUtils {
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(1, mcMMO.p));
}
/**
* Marks a block to drop extra copies of items
* @param blockState target blockstate
* @param amount amount of extra items to drop
*/
public static void markDropsAsBonus(BlockState blockState, int amount) {
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(amount, mcMMO.p));
}
/**
* Checks if a player successfully passed the double drop check
*

View File

@@ -4,6 +4,7 @@ import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.experience.SpecialXPKey;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.meta.OldName;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
@@ -31,10 +32,12 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.projectiles.ProjectileSource;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public final class CombatUtils {
@@ -347,6 +350,25 @@ public final class CombatUtils {
}
}
/**
* This cleans up names from displaying in chat as hearts
* @param entity target entity
*/
public static void fixNames(LivingEntity entity)
{
List<MetadataValue> metadataValue = entity.getMetadata("mcMMO_oldName");
if(metadataValue.size() <= 0)
return;
if(metadataValue != null)
{
OldName oldName = (OldName) metadataValue.get(0);
entity.setCustomName(oldName.asString());
entity.setCustomNameVisible(false);
}
}
public static int getLimitBreakDamage(Player player, SubSkillType subSkillType) {
return RankUtils.getRank(player, subSkillType);
}