Update 5.14

This commit is contained in:
sky
2020-01-14 21:21:55 +08:00
parent c02973fe1b
commit 2a038c3baf
11 changed files with 165 additions and 83 deletions

View File

@@ -1,12 +1,13 @@
package io.izzel.taboolib.util.lite;
import io.izzel.taboolib.TabooLib;
import io.izzel.taboolib.Version;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import java.util.Optional;
public class SoundPack {
private Sound sound;
@@ -15,7 +16,7 @@ public class SoundPack {
private int delay;
public SoundPack() {
this.sound = Sound.valueOf(getModifiedSound("ENTITY_VILLAGER_NO"));
this.sound = Sounds.ENTITY_VILLAGER_NO.parseSound();
this.a = 1.0F;
this.b = 1.0F;
}
@@ -51,7 +52,7 @@ public class SoundPack {
this.b = Float.parseFloat(split[2]);
this.delay = split.length > 3 ? Integer.parseInt(split[3]) : 0;
} catch (Exception var3) {
this.sound = Sound.valueOf(getModifiedSound("ENTITY_VILLAGER_NO"));
this.sound = Sounds.ENTITY_VILLAGER_NO.parseSound();
this.a = 1.0F;
this.b = 1.0F;
this.delay = 0;
@@ -59,28 +60,8 @@ public class SoundPack {
}
public static String getModifiedSound(String str) {
if (Version.isBefore(Version.v1_9)) {
str = str.replace("BLOCK_FIRE_EXTINGUISH", "FIZZ");
str = str.replace("BLOCK_NOTE_HAT", "NOTE_STICKS");
str = str.replace("ENTITY_SHEEP_DEATH", "SHEEP_IDLE");
str = str.replace("ENTITY_LLAMA_ANGRY", "HORSE_HIT");
str = str.replace("BLOCK_BREWING_STAND_BREW", "CREEPER_HISS");
str = str.replace("ENTITY_SHULKER_TELEPORT", "ENDERMAN_TELEPORT");
str = str.replace("ENTITY_ZOMBIE_ATTACK_IRON_DOOR", "ZOMBIE_METAL");
str = str.replace("BLOCK_GRAVEL_BREAK", "DIG_GRAVEL");
str = str.replace("BLOCK_SNOW_BREAK", "DIG_SNOW");
str = str.replace("BLOCK_GRAVEL_BREAK", "DIG_GRAVEL");
str = str.replace("ENTITY_PLAYER_LEVELUP", "LEVEL_UP");
str = str.replace("ENTITY_SNOWBALL_THROW", "SHOOT_ARROW");
str = str.replace("PLAYER_ATTACK_CRIT", "ITEM_BREAK");
str = str.replace("ENDERMEN", "ENDERMAN");
str = str.replace("ARROW_SHOOT", "SHOOT_ARROW");
str = str.replace("ENDERMAN_HURT", "ENDERMAN_HIT");
str = str.replace("BLAZE_HURT", "BLAZE_HIT");
str = str.replace("_FLAP", "_WINGS");
str = str.replaceAll("ENTITY_|GENERIC_|BLOCK_|_AMBIENT|_BREAK|UI_BUTTON_|EXPERIENCE_", "");
}
return str;
Optional<Sound> sound = Sounds.parseSound(str);
return sound.map(Enum::name).orElse(str);
}
// *********************************