mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-03 18:33:16 +01:00
Even better regex.
This commit is contained in:
parent
c151366952
commit
dc0800e7e1
@ -30,10 +30,8 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.chat.ChatManager;
|
import com.gmail.nossr50.chat.ChatManager;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -64,15 +62,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerDeathHighest(PlayerDeathEvent event) {
|
public void onPlayerDeathHighest(PlayerDeathEvent event) {
|
||||||
String deathMessage = event.getDeathMessage();
|
String deathMessage = event.getDeathMessage();
|
||||||
PlayerProfile profile = UserManager.getPlayer(event.getEntity()).getProfile();
|
deathMessage.replaceAll("(?:\\u00A7(?:[1-9a-fklmnor]){1}(?:[❤■]{1,10})){1,2}", 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.replaceFirst("(?:\\u00A7(?:[1-9a-fklmnor]){1}(?:■{1,10})){1,2}", ChatColor.RESET + "a mob");
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setDeathMessage(deathMessage);
|
event.setDeathMessage(deathMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user