/bending display [element] is in alphabetical order

This commit is contained in:
MistPhizzle 2014-07-22 22:48:12 -04:00
parent 290696879d
commit d51ee9b9d2
3 changed files with 22 additions and 12 deletions

View file

@ -1,6 +1,8 @@
package com.projectkorra.ProjectKorra.Ability; package com.projectkorra.ProjectKorra.Ability;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -17,11 +19,11 @@ public class AbilityModuleManager {
private final AbilityLoader<AbilityModule> loader; private final AbilityLoader<AbilityModule> loader;
public static HashSet<String> abilities; public static HashSet<String> abilities;
public static HashSet<String> waterbendingabilities; public static List<String> waterbendingabilities;
public static HashSet<String> airbendingabilities; public static List<String> airbendingabilities;
public static HashSet<String> earthbendingabilities; public static List<String> earthbendingabilities;
public static HashSet<String> firebendingabilities; public static List<String> firebendingabilities;
public static HashSet<String> chiabilities; public static List<String> chiabilities;
public static HashSet<String> shiftabilities; public static HashSet<String> shiftabilities;
public static HashMap<String, String> authors; public static HashMap<String, String> authors;
public static HashSet<String> harmlessabilities; public static HashSet<String> harmlessabilities;
@ -39,11 +41,11 @@ public class AbilityModuleManager {
} }
loader = new AbilityLoader<AbilityModule>(plugin, path, new Object[] {}); loader = new AbilityLoader<AbilityModule>(plugin, path, new Object[] {});
abilities = new HashSet<String>(); abilities = new HashSet<String>();
waterbendingabilities = new HashSet<String>(); waterbendingabilities = new ArrayList<String>();
airbendingabilities = new HashSet<String>(); airbendingabilities = new ArrayList<String>();
earthbendingabilities = new HashSet<String>(); earthbendingabilities = new ArrayList<String>();
firebendingabilities = new HashSet<String>(); firebendingabilities = new ArrayList<String>();
chiabilities = new HashSet<String>(); chiabilities = new ArrayList<String>();
shiftabilities = new HashSet<String>(); shiftabilities = new HashSet<String>();
descriptions = new HashMap<String, String>(); descriptions = new HashMap<String, String>();
authors = new HashMap<String, String>(); authors = new HashMap<String, String>();
@ -154,6 +156,12 @@ public class AbilityModuleManager {
descriptions.put(ab.getName(), ab.getDescription()); descriptions.put(ab.getName(), ab.getDescription());
authors.put(ab.getName(), ab.getAuthor()); authors.put(ab.getName(), ab.getAuthor());
} }
Collections.sort(airbendingabilities);
Collections.sort(waterbendingabilities);
Collections.sort(earthbendingabilities);
Collections.sort(firebendingabilities);
Collections.sort(chiabilities);
} }
} }

View file

@ -5,6 +5,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -404,7 +406,7 @@ public class Commands {
s.sendMessage(Methods.getChiColor() + "There are no chiblocking abilities available."); s.sendMessage(Methods.getChiColor() + "There are no chiblocking abilities available.");
return true; return true;
} }
for (String st: AbilityModuleManager.chiabilities) { for (String st: AbilityModuleManager.chiabilities) {
if (Methods.hasPermission((Player) s, st)) { if (Methods.hasPermission((Player) s, st)) {
s.sendMessage(Methods.getChiColor() + st); s.sendMessage(Methods.getChiColor() + st);

View file

@ -570,7 +570,7 @@ public class PKListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (Methods.isChiBlocked(player.getName())) { if (Methods.isChiBlocked(player.getName())) {
event.setCancelled(true); event.setCancelled(true);
return; return;