Fixed NPE with TagAPI and added config option for it

This commit is contained in:
kingbirdy 2014-08-01 01:34:13 -04:00
parent 97bd39c076
commit ac813496a4
2 changed files with 16 additions and 12 deletions

View file

@ -63,6 +63,8 @@ public class ConfigManager {
config.addDefault("Properties.RegionProtection.RespectTowny", true); config.addDefault("Properties.RegionProtection.RespectTowny", true);
config.addDefault("Properties.RegionProtection.RespectPreciousStones", true); config.addDefault("Properties.RegionProtection.RespectPreciousStones", true);
config.addDefault("Properties.TagAPI.Enabled", true);
config.addDefault("Properties.Air.CanBendWithWeapons", false); config.addDefault("Properties.Air.CanBendWithWeapons", false);
config.addDefault("Properties.Air.Particles", "smoke"); config.addDefault("Properties.Air.Particles", "smoke");

View file

@ -18,6 +18,7 @@ public class TagAPIListener implements Listener {
@EventHandler @EventHandler
public void onNameTag(AsyncPlayerReceiveNameTagEvent e) { public void onNameTag(AsyncPlayerReceiveNameTagEvent e) {
List<Element> elements = Methods.getBendingPlayer(e.getNamedPlayer().getName()).getElements(); List<Element> elements = Methods.getBendingPlayer(e.getNamedPlayer().getName()).getElements();
if (elements!=null && plugin.getConfig().getBoolean("Properties.TagAPI.Enabled")) {
if (elements.size() > 1) if (elements.size() > 1)
e.setTag(ChatColor.LIGHT_PURPLE + e.getNamedPlayer().getName()); e.setTag(ChatColor.LIGHT_PURPLE + e.getNamedPlayer().getName());
else if (elements.get(0).equals(Element.Earth)) else if (elements.get(0).equals(Element.Earth))
@ -31,4 +32,5 @@ public class TagAPIListener implements Listener {
else if (elements.get(0).equals(Element.Chi)) else if (elements.get(0).equals(Element.Chi))
e.setTag(ChatColor.GOLD + e.getNamedPlayer().getName()); e.setTag(ChatColor.GOLD + e.getNamedPlayer().getName());
} }
}
} }