mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-14 04:47:51 +00:00
Fixed NullPointer errors and Fixed combo messages.
This commit is contained in:
parent
acb5a40b30
commit
9346bf02b7
3 changed files with 18 additions and 11 deletions
|
@ -409,7 +409,7 @@ public class GeneralMethods {
|
|||
}
|
||||
if (((LivingEntity) entity).getHealth() - damage <= 0 && entity instanceof Player && !entity.isDead()) {
|
||||
if (ability == null) {
|
||||
ability = getLastUsedAbility(player);
|
||||
ability = getLastUsedAbility(player, true);
|
||||
}
|
||||
if (ability != null && !ability.isEmpty()) {
|
||||
PlayerBendingDeathEvent event = new PlayerBendingDeathEvent((Player) entity, player, ability, damage);
|
||||
|
@ -430,10 +430,10 @@ public class GeneralMethods {
|
|||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public static String getLastUsedAbility(Player player){
|
||||
public static String getLastUsedAbility(Player player, boolean checkCombos){
|
||||
List<AbilityInformation> lastUsedAbility = ComboManager.getRecentlyUsedAbilities(player, 1);
|
||||
if (!lastUsedAbility.isEmpty()) {
|
||||
if(ComboManager.checkForValidCombo(player) != null){
|
||||
if(ComboManager.checkForValidCombo(player) != null && checkCombos){
|
||||
return ComboManager.checkForValidCombo(player).getName();
|
||||
}else {
|
||||
return lastUsedAbility.get(0).getAbilityName();
|
||||
|
|
|
@ -1122,13 +1122,20 @@ public class PKListener implements Listener {
|
|||
if (bendingDeathPlayer.containsKey(event.getEntity())) {
|
||||
String message = ConfigManager.deathMsgConfig.getConfig().getString("Properties.Default");
|
||||
String ability = bendingDeathPlayer.get(event.getEntity());
|
||||
String element = GeneralMethods.getAbilityElement(ability).name();
|
||||
if(ConfigManager.deathMsgConfig.getConfig().contains(element + "." + ability)){
|
||||
String element = null;
|
||||
if (GeneralMethods.abilityExists(ability)) {
|
||||
element = GeneralMethods.getAbilityElement(ability).name();
|
||||
}
|
||||
if (ComboManager.checkForValidCombo(event.getEntity().getKiller()).getName().equalsIgnoreCase(ability)) {
|
||||
element = GeneralMethods.getAbilityElement(GeneralMethods.getLastUsedAbility(event.getEntity().getKiller(), false)).name();
|
||||
ability = element + "Combo";
|
||||
}
|
||||
if (ConfigManager.deathMsgConfig.getConfig().contains(element + "." + ability)) {
|
||||
message = ConfigManager.deathMsgConfig.getConfig().getString(element + "." + ability);
|
||||
}
|
||||
message = message.replace("{victim}", event.getEntity().getName())
|
||||
.replace("{attacker}", event.getEntity().getKiller().getName())
|
||||
.replace("{ability}", GeneralMethods.getAbilityColor(ability) + ability);
|
||||
.replace("{ability}", GeneralMethods.getAbilityColor(GeneralMethods.getLastUsedAbility(event.getEntity().getKiller(), false)) + ability);
|
||||
event.setDeathMessage(message);
|
||||
bendingDeathPlayer.remove(event.getEntity());
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ConfigManager {
|
|||
config.addDefault("Air.AirBurst", "{victim} was thrown down by {attacker}'s {ability}");
|
||||
config.addDefault("Air.AirSwipe", "{victim} was struck by {attacker}'s {ability}");
|
||||
config.addDefault("Air.Suffocate", "{victim} was asphyxiated by {attacker}'s {ability}");
|
||||
config.addDefault("Air.Combo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
config.addDefault("Air.AirCombo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
|
||||
config.addDefault("Water.IceBlast", "{victim} was shattered by {attacker}'s {ability}");
|
||||
config.addDefault("Water.Torrent", "{victim} was taken down by {attacker}'s {ability}");
|
||||
|
@ -41,7 +41,7 @@ public class ConfigManager {
|
|||
config.addDefault("Water.WaterArms", "{victim} was too slow for {attacker}'s {ability}");
|
||||
config.addDefault("Water.OctopusForm", "{victim} was slapped by {attacker}'s {ability}");
|
||||
config.addDefault("Water.Bloodbending", "{victim} was destroyed by {attacker}'s {ability}");
|
||||
config.addDefault("Water.Combo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
config.addDefault("Water.WaterCombo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
|
||||
config.addDefault("Earth.Collapse", "{victim} was suffocated by {attacker}'s {ability}");
|
||||
config.addDefault("Earth.EarthBlast", "{victim} was broken apart by {attacker}'s {ability}");
|
||||
|
@ -49,7 +49,7 @@ public class ConfigManager {
|
|||
config.addDefault("Earth.LavaFlow", "{victim} was caught in by {attacker}'s {ability}");
|
||||
config.addDefault("Earth.MetalClips", "{victim} was too slow for {attacker}'s {ability}");
|
||||
config.addDefault("Earth.Shockwave", "{victim} was blown away by {attacker}'s {ability}");
|
||||
config.addDefault("Earth.Combo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
config.addDefault("Earth.EarthCombo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
|
||||
config.addDefault("Fire.FireBlast", "{victim} was burnt by {attacker}'s {ability}");
|
||||
config.addDefault("Fire.Blaze", "{victim} was burned alive by {attacker}'s {ability}");
|
||||
|
@ -58,12 +58,12 @@ public class ConfigManager {
|
|||
config.addDefault("Fire.Combustion", "{victim} was shot down by {attacker}'s {ability}");
|
||||
config.addDefault("Fire.FireBurst", "{victim} was blown apart by {attacker}'s {ability}");
|
||||
config.addDefault("Fire.FireShield", "{victim} scorched theirself on {attacker}'s {ability}");
|
||||
config.addDefault("Fire.Combo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
config.addDefault("Fire.FireCombo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
|
||||
config.addDefault("Chi.QuickStrike", "{victim} was struck down by {attacker}'s {ability}");
|
||||
config.addDefault("Chi.SwiftKick", "{victim} was kicked to the floor by {attacker}'s {ability}");
|
||||
config.addDefault("Chi.RapidPunch", "{victim} took all the hits against {attacker}'s {ability}");
|
||||
config.addDefault("Chi.Combo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
config.addDefault("Chi.ChiCombo", "{victim} was overwhelmed by {attacker}'s skill {ability}");
|
||||
|
||||
config.options().copyDefaults(true);
|
||||
deathMsgConfig.saveConfig();
|
||||
|
|
Loading…
Reference in a new issue