mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-12 03:59:06 +00:00
Merge pull request #264 from jedk1/master
Fix AddCommand & DeathMessages
This commit is contained in:
commit
88b699bd8c
4 changed files with 36 additions and 9 deletions
|
@ -75,4 +75,18 @@ public enum Element {
|
||||||
return null;
|
return null;
|
||||||
return Arrays.asList(values()).get(index);
|
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,17 @@ public class PKListener implements Listener {
|
||||||
if (bendingDeathPlayer.containsKey(event.getEntity())) {
|
if (bendingDeathPlayer.containsKey(event.getEntity())) {
|
||||||
String message = ConfigManager.deathMsgConfig.get().getString("Properties.Default");
|
String message = ConfigManager.deathMsgConfig.get().getString("Properties.Default");
|
||||||
String ability = bendingDeathPlayer.get(event.getEntity());
|
String ability = bendingDeathPlayer.get(event.getEntity());
|
||||||
String tempAbility = ChatColor.stripColor(ability);
|
String tempAbility = ChatColor.stripColor(ability).replaceAll(" ", "");
|
||||||
Element element = null;
|
Element element = null;
|
||||||
|
boolean isAvatarAbility = false;
|
||||||
if (GeneralMethods.abilityExists(tempAbility)) {
|
if (GeneralMethods.abilityExists(tempAbility)) {
|
||||||
element = GeneralMethods.getAbilityElement(tempAbility);
|
element = GeneralMethods.getAbilityElement(tempAbility);
|
||||||
|
if (element == null) {
|
||||||
|
isAvatarAbility = true;
|
||||||
|
ability = GeneralMethods.getAvatarColor() + tempAbility;
|
||||||
|
}
|
||||||
|
} else if (ChatColor.getByChar(ability.substring(1, 2)) != null) {
|
||||||
|
element = Element.getFromChatColor(ChatColor.getByChar(ability.substring(1, 2)));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Player killer = event.getEntity().getKiller();
|
Player killer = event.getEntity().getKiller();
|
||||||
|
@ -936,9 +943,15 @@ public class PKListener implements Listener {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if (ConfigManager.deathMsgConfig.get().contains(element.toString() + "." + tempAbility)) {
|
if (ConfigManager.deathMsgConfig.get().contains(element.toString() + "." + tempAbility)) {
|
||||||
message = ConfigManager.deathMsgConfig.get().getString(element + "." + tempAbility);
|
message = ConfigManager.deathMsgConfig.get().getString(element + "." + tempAbility);
|
||||||
|
} else if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
||||||
|
message = ConfigManager.deathMsgConfig.get().getString("Combo." + tempAbility);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
if (isAvatarAbility) {
|
||||||
|
if (ConfigManager.deathMsgConfig.get().contains("Avatar." + tempAbility)) {
|
||||||
|
message = ConfigManager.deathMsgConfig.get().getString("Avatar." + tempAbility);
|
||||||
|
}
|
||||||
|
} else if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
||||||
message = ConfigManager.deathMsgConfig.get().getString("Combo." + tempAbility);
|
message = ConfigManager.deathMsgConfig.get().getString("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.");
|
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') {
|
} 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.");
|
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.");
|
target.sendMessage(color + "You are now a Chiblocker.");
|
||||||
}
|
}
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
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.");
|
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') {
|
} 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.");
|
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")) {
|
} else if (element.charAt(0) == 'c' || element.equalsIgnoreCase("chi")) {
|
||||||
target.sendMessage(color + "You are now a Chiblocker.");
|
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "blocker.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GeneralMethods.saveElements(bPlayer);
|
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);
|
entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.VILLAGER_HIT, 0.3f, 0.3f);
|
||||||
|
|
||||||
if (ability.equalsIgnoreCase("FireKick")) {
|
if (ability.equalsIgnoreCase("FireKick")) {
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "FireKick");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireKick");
|
||||||
fstream.remove();
|
fstream.remove();
|
||||||
} else if (ability.equalsIgnoreCase("FireSpin")) {
|
} else if (ability.equalsIgnoreCase("FireSpin")) {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
|
@ -229,19 +229,19 @@ public class FireCombo implements ConfigLoadable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double knockback = AvatarState.isAvatarState(player) ? FIRE_SPIN_KNOCKBACK + 0.5 : FIRE_SPIN_KNOCKBACK;
|
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));
|
entity.setVelocity(direction.normalize().multiply(knockback));
|
||||||
fstream.remove();
|
fstream.remove();
|
||||||
} else if (ability.equalsIgnoreCase("JetBlaze")) {
|
} else if (ability.equalsIgnoreCase("JetBlaze")) {
|
||||||
if (!affectedEntities.contains(entity)) {
|
if (!affectedEntities.contains(entity)) {
|
||||||
affectedEntities.add(entity);
|
affectedEntities.add(entity);
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "JetBlaze");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "JetBlaze");
|
||||||
entity.setFireTicks((int) (fireticksJetBlaze * 20));
|
entity.setFireTicks((int) (fireticksJetBlaze * 20));
|
||||||
}
|
}
|
||||||
} else if (ability.equalsIgnoreCase("FireWheel")) {
|
} else if (ability.equalsIgnoreCase("FireWheel")) {
|
||||||
if (!affectedEntities.contains(entity)) {
|
if (!affectedEntities.contains(entity)) {
|
||||||
affectedEntities.add(entity);
|
affectedEntities.add(entity);
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "FireWheel");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireWheel");
|
||||||
entity.setFireTicks((int) (fireticksFireWheel * 20));
|
entity.setFireTicks((int) (fireticksFireWheel * 20));
|
||||||
this.remove();
|
this.remove();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue