Give Metalbending its own color

This color is configurable (Defaults: Dark Green). Will display
abilities in /bending display and their descriptions in this color if
they are metalbending abilities.
This commit is contained in:
MistPhizzle 2014-07-10 10:38:26 -04:00
parent bbece259e1
commit 4f2a59f942
6 changed files with 42 additions and 3 deletions

View file

@ -27,6 +27,7 @@ public class AbilityModuleManager {
public static HashSet<String> harmlessabilities;
public static HashSet<String> igniteabilities;
public static HashSet<String> explodeabilities;
public static HashSet<String> metalbendingabilities;
public static HashMap<String, String> descriptions;
@ -49,6 +50,7 @@ public class AbilityModuleManager {
harmlessabilities = new HashSet<String>();
explodeabilities = new HashSet<String>();
igniteabilities = new HashSet<String>();
metalbendingabilities = new HashSet<String>();
ability = loader.load(AbilityModule.class);
fill();
}

View file

@ -255,7 +255,11 @@ public class Commands {
}
for (String st: AbilityModuleManager.earthbendingabilities) {
if (Methods.hasPermission((Player) s, st)) {
s.sendMessage(Methods.getEarthColor() + st);
if (Methods.isMetalbendingAbility(st)) {
s.sendMessage(Methods.getMetalbendingColor() + st);
} else {
s.sendMessage(Methods.getEarthColor() + st);
}
}
}
return true;
@ -361,6 +365,9 @@ public class Commands {
s.sendMessage(Methods.getWaterColor() + "- Waterbender");
}
if (Methods.isBender(un, Element.Earth)) {
if (Methods.canMetalbend(p)) {
s.sendMessage(Methods.getEarthColor() + "- Earthbender " + Methods.getMetalbendingColor() + "(Can Metalbend)");
}
s.sendMessage(Methods.getEarthColor() + "- Earthbender");
}
if (Methods.isBender(un, Element.Fire)) {
@ -770,8 +777,13 @@ public class Commands {
s.sendMessage(Methods.getWaterColor() + AbilityModuleManager.descriptions.get(ability));
}
else if (Methods.isEarthAbility(ability)) {
s.sendMessage(Methods.getEarthColor() + ability + " - ");
s.sendMessage(Methods.getEarthColor() + AbilityModuleManager.descriptions.get(ability));
if (Methods.isMetalbendingAbility(ability)) {
s.sendMessage(Methods.getMetalbendingColor() + ability + " - ");
s.sendMessage(Methods.getMetalbendingColor() + AbilityModuleManager.descriptions.get(ability));
} else {
s.sendMessage(Methods.getEarthColor() + ability + " - ");
s.sendMessage(Methods.getEarthColor() + AbilityModuleManager.descriptions.get(ability));
}
}
else if (Methods.isFireAbility(ability)) {
s.sendMessage(Methods.getFireColor() + ability + " - ");

View file

@ -44,6 +44,7 @@ public class ConfigManager {
config.addDefault("Properties.Chat.Colors.Air", "GRAY");
config.addDefault("Properties.Chat.Colors.Water", "AQUA");
config.addDefault("Properties.Chat.Colors.Earth", "GREEN");
config.addDefault("Properties.Chat.Colors.Metalbending", "DARK_GREEN");
config.addDefault("Properties.Chat.Colors.Fire", "RED");
config.addDefault("Properties.Chat.Colors.Chi", "GOLD");

View file

@ -499,6 +499,10 @@ public class Methods {
public static ChatColor getEarthColor() {
return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Earth"));
}
public static ChatColor getMetalbendingColor() {
return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Metalbending"));
}
public static ChatColor getFireColor() {
return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Fire"));
@ -1618,10 +1622,26 @@ public class Methods {
if (player.hasPermission("bending.earth.metalbending")) return true;
return false;
}
public static boolean isMetalBlock(Block block) {
if (block.getType() == Material.GOLD_BLOCK
|| block.getType() == Material.IRON_BLOCK
|| block.getType() == Material.IRON_ORE
|| block.getType() == Material.GOLD_ORE
|| block.getType() == Material.QUARTZ_BLOCK
|| block.getType() == Material.QUARTZ_ORE)
return true;
return false;
}
private static Integer[] plantIds = { 6, 18, 31, 32, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175};
public static Integer[] transparentToEarthbending = {0, 6, 8, 9, 10, 11, 30, 31, 32, 37, 38, 39, 40, 50, 51, 59, 78, 83, 106};
public static Integer[] nonOpaque = {0, 6, 8, 9, 10, 11, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 68, 69, 70, 72,
75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132};
public static boolean isMetalbendingAbility(String ability) {
if (AbilityModuleManager.metalbendingabilities.contains(ability)) return true;
return false;
}
}

View file

@ -18,6 +18,9 @@ public class EarthPassive {
public static boolean softenLanding(Player player) {
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (Methods.canMetalbend(player) && Methods.isMetalBlock(block)) {
return true;
}
if (Methods.isEarthbendable(player, block) || Methods.isTransparentToEarthbending(player, block)) {
if (!Methods.isTransparentToEarthbending(player, block)) {
Material type = block.getType();

View file

@ -17,6 +17,7 @@ Properties:
Fire: RED
Water: AQUA
Earth: GREEN
Metalbending: DARK_GREEN
Chi: GOLD
RegionProtection:
AllowHarmlessAbilities: true