Fixed default config sound names + better sound name compatibility

This commit is contained in:
Indyuce 2021-11-28 10:01:47 +01:00
parent 9128fe63f9
commit 91f136774e
4 changed files with 19 additions and 12 deletions

View File

@ -6,15 +6,17 @@ import io.lumine.mythic.lib.api.stat.StatMap;
import io.lumine.mythic.lib.damage.AttackMetadata;
import io.lumine.mythic.lib.damage.DamageMetadata;
import io.lumine.mythic.lib.damage.DamageType;
import net.Indyuce.mmoitems.ability.Ability;
import net.Indyuce.mmoitems.api.player.PlayerData;
import org.bukkit.entity.LivingEntity;
/**
* The attack metadata used here in MMOItems. It
* extends the default attack metadata from MythicLib
* to benefit from all its methods
* The attack metadata used here in MMOItems. It extends the default
* attack metadata from MythicLib to benefit from all its methods
*
* @deprecated Elemental damage calculation will be moved to MythicLib and this
* class will therefore be 100% useless
*/
@Deprecated
public class ItemAttackMetadata extends AttackMetadata {
public ItemAttackMetadata(DamageMetadata damage, StatMap.CachedStatMap damager) {
super(damage, damager);

View File

@ -26,6 +26,10 @@ public class Tool extends UseItem {
return MythicLib.plugin.getFlags().isFlagAllowed(player, CustomFlag.MI_TOOLS) && playerData.getRPG().canUse(getNBTItem(), true);
}
/**
* @param block Block being broken
* @return If the mining event should be canceled
*/
public boolean miningEffects(Block block) {
boolean cancel = false;
@ -46,8 +50,7 @@ public class Tool extends UseItem {
int j = 0;
public void run() {
j++;
if (j > 10)
if (j++ > 10)
cancel();
loc.add(v);

View File

@ -238,8 +238,10 @@ public class CustomSounds extends ItemStat implements GemStoneStat, PlayerConsum
if (cs == null) playDefaultSound(player);
// Play custom sound lets go
else
player.getWorld().playSound(player.getLocation(), cs.getSound(), (float) cs.getVolume(), (float) cs.getPitch());
else {
String fixedSoundName = cs.getSound().toLowerCase().replace("_", ".");
player.getWorld().playSound(player.getLocation(), fixedSoundName, (float) cs.getVolume(), (float) cs.getPitch());
}
}
void playDefaultSound(@NotNull Player player) { player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EAT, 1, 1); }

View File

@ -164,7 +164,7 @@ LARGE_HEALTH_POTION:
name: '&fLarge Health Potion'
item-cooldown: 10.0
sounds:
on-consume: ENTITY_GENERIC_DRINK
on-consume: entity.generic.drink
restore-health: 10.0
LARGE_MANA_POTION:
base:
@ -179,7 +179,7 @@ LARGE_MANA_POTION:
max-spread: 0.13
item-cooldown: 15.0
sounds:
on-consume: ENTITY_GENERIC_DRINK
on-consume: entity.generic.drink
TACO:
base:
material: PLAYER_HEAD
@ -295,7 +295,7 @@ SANTA_COOKIE:
lore:
- '&7&oWhere are the darn cookies!'
sounds:
on-consume: ENTITY_PLAYER_BURP
on-consume: entity.player.burp
item-cooldown: 2.0
effects:
SPEED:
@ -314,7 +314,7 @@ ENDER_NOTE:
name: '&5Ender Tome'
item-cooldown: 180
sounds:
on-consume: ENTITY_ENDERMAN_TELEPORT
on-consume: entity.enderman.teleport
lore:
- '&7Teleports you &5miles&7 away.'
effects: