Better regex for this.

This commit is contained in:
GJ 2013-04-07 23:58:53 -04:00
parent 212137ec3e
commit c151366952

View File

@ -66,11 +66,11 @@ public class PlayerListener implements Listener {
String deathMessage = event.getDeathMessage();
PlayerProfile profile = UserManager.getPlayer(event.getEntity()).getProfile();
if (profile.getMobHealthbarType() == MobHealthbarType.HEARTS && deathMessage.contains("")) {
deathMessage.replaceFirst("❤+", ChatColor.RESET + "a mob");
if (profile.getMobHealthbarType() == MobHealthbarType.HEARTS && deathMessage.contains("")) {
deathMessage.replaceFirst("(?:\\u00A7(?:[1-9a-fklmnor]){1}(?:❤{1,10})){1,2}", ChatColor.RESET + "a mob");
}
else if (profile.getMobHealthbarType() == MobHealthbarType.BAR && deathMessage.contains("■■■■■■■■■")) {
deathMessage.replace("■■■■■■■■■■", ChatColor.RESET + "a mob");
else if (profile.getMobHealthbarType() == MobHealthbarType.BAR && deathMessage.contains("")) {
deathMessage.replaceFirst("(?:\\u00A7(?:[1-9a-fklmnor]){1}(?:■{1,10})){1,2}", ChatColor.RESET + "a mob");
}
event.setDeathMessage(deathMessage);