mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Fix AddCommand & DeathMessages
Fixes AddCommand not showing sender chi message. Fixes DeathMessages not showing messages for WaterArms. Fixes FireCombos DeathMessage colors not working.
This commit is contained in:
parent
f267808d49
commit
f79557c71d
4 changed files with 26 additions and 8 deletions
|
@ -75,4 +75,18 @@ public enum Element {
|
|||
return null;
|
||||
return Arrays.asList(values()).get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an element based on ChatColor.
|
||||
* @param color
|
||||
* @return
|
||||
*/
|
||||
public static Element getFromChatColor(ChatColor color) {
|
||||
for (Element element : Element.values()) {
|
||||
if (element.getChatColor().equals(color) || element.getSubColor().equals(color)) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -909,10 +909,12 @@ public class PKListener implements Listener {
|
|||
if (bendingDeathPlayer.containsKey(event.getEntity())) {
|
||||
String message = ConfigManager.deathMsgConfig.get().getString("Properties.Default");
|
||||
String ability = bendingDeathPlayer.get(event.getEntity());
|
||||
String tempAbility = ChatColor.stripColor(ability);
|
||||
String tempAbility = ChatColor.stripColor(ability).replaceAll(" ", "");
|
||||
Element element = null;
|
||||
if (GeneralMethods.abilityExists(tempAbility)) {
|
||||
element = GeneralMethods.getAbilityElement(tempAbility);
|
||||
} else if (ChatColor.getByChar(ability.substring(1, 2)) != null) {
|
||||
element = Element.getFromChatColor(ChatColor.getByChar(ability.substring(1, 2)));
|
||||
}
|
||||
/*
|
||||
Player killer = event.getEntity().getKiller();
|
||||
|
@ -936,6 +938,8 @@ public class PKListener implements Listener {
|
|||
if (element != null) {
|
||||
if (ConfigManager.deathMsgConfig.get().contains(element.toString() + "." + tempAbility)) {
|
||||
message = ConfigManager.deathMsgConfig.get().getString(element + "." + tempAbility);
|
||||
} else if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
||||
message = ConfigManager.deathMsgConfig.get().getString("Combo." + tempAbility);
|
||||
}
|
||||
} else {
|
||||
if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
||||
|
|
|
@ -70,7 +70,7 @@ public class AddCommand extends PKCommand {
|
|||
target.sendMessage(color + "You are also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||
target.sendMessage(color + "You are also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.equalsIgnoreCase("chi")) {
|
||||
} else if (element.charAt(0) == 'c' || element.equalsIgnoreCase("chi")) {
|
||||
target.sendMessage(color + "You are now a Chiblocker.");
|
||||
}
|
||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||
|
@ -78,8 +78,8 @@ public class AddCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||
} else if (element.equalsIgnoreCase("chi")) {
|
||||
target.sendMessage(color + "You are now a Chiblocker.");
|
||||
} else if (element.charAt(0) == 'c' || element.equalsIgnoreCase("chi")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "blocker.");
|
||||
}
|
||||
}
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
|
|
|
@ -221,7 +221,7 @@ public class FireCombo implements ConfigLoadable {
|
|||
entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.VILLAGER_HIT, 0.3f, 0.3f);
|
||||
|
||||
if (ability.equalsIgnoreCase("FireKick")) {
|
||||
GeneralMethods.damageEntity(player, entity, damage, "FireKick");
|
||||
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireKick");
|
||||
fstream.remove();
|
||||
} else if (ability.equalsIgnoreCase("FireSpin")) {
|
||||
if (entity instanceof Player) {
|
||||
|
@ -229,19 +229,19 @@ public class FireCombo implements ConfigLoadable {
|
|||
return;
|
||||
}
|
||||
double knockback = AvatarState.isAvatarState(player) ? FIRE_SPIN_KNOCKBACK + 0.5 : FIRE_SPIN_KNOCKBACK;
|
||||
GeneralMethods.damageEntity(player, entity, damage, "FireSpin");
|
||||
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireSpin");
|
||||
entity.setVelocity(direction.normalize().multiply(knockback));
|
||||
fstream.remove();
|
||||
} else if (ability.equalsIgnoreCase("JetBlaze")) {
|
||||
if (!affectedEntities.contains(entity)) {
|
||||
affectedEntities.add(entity);
|
||||
GeneralMethods.damageEntity(player, entity, damage, "JetBlaze");
|
||||
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "JetBlaze");
|
||||
entity.setFireTicks((int) (fireticksJetBlaze * 20));
|
||||
}
|
||||
} else if (ability.equalsIgnoreCase("FireWheel")) {
|
||||
if (!affectedEntities.contains(entity)) {
|
||||
affectedEntities.add(entity);
|
||||
GeneralMethods.damageEntity(player, entity, damage, "FireWheel");
|
||||
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireWheel");
|
||||
entity.setFireTicks((int) (fireticksFireWheel * 20));
|
||||
this.remove();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue