fixed category getter

This commit is contained in:
BuildTools 2018-08-23 13:24:38 +02:00
parent 37dfc3ca85
commit 9c8acdd3ff
5 changed files with 21 additions and 28 deletions

View File

@ -15,7 +15,12 @@ public class JeffChestSortCategory {
boolean asteriskBefore = false; boolean asteriskBefore = false;
boolean asteriskAfter = false; boolean asteriskAfter = false;
//System.out.println("Checking if "+itemname + " is in cat "+name);
for(String typeMatch : typeMatches) { for(String typeMatch : typeMatches) {
//System.out.println(" Checking if "+itemname + " matches "+typeMatch);
if(typeMatch.startsWith("*")) { if(typeMatch.startsWith("*")) {
asteriskBefore = true; asteriskBefore = true;
typeMatch=typeMatch.substring(1); typeMatch=typeMatch.substring(1);
@ -27,6 +32,7 @@ public class JeffChestSortCategory {
if(asteriskBefore == false && asteriskAfter == false) { if(asteriskBefore == false && asteriskAfter == false) {
if(itemname.equalsIgnoreCase(typeMatch)) { if(itemname.equalsIgnoreCase(typeMatch)) {
return true; return true;
} }
} else if(asteriskBefore == true && asteriskAfter == true) { } else if(asteriskBefore == true && asteriskAfter == true) {

View File

@ -54,9 +54,9 @@ public class JeffChestSortOrganizer {
Scanner sc = new Scanner(file); Scanner sc = new Scanner(file);
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
while (sc.hasNextLine()) { while (sc.hasNextLine()) {
if(!sc.nextLine().startsWith("#")) { //if(!sc.nextLine().startsWith("#")) {
lines.add(sc.nextLine()); lines.add(sc.nextLine());
} //}
} }
String[] arr = lines.toArray(new String[0]); String[] arr = lines.toArray(new String[0]);

View File

@ -30,9 +30,16 @@ public class JeffChestSortPlugin extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
for(Material mat : Material.values()) {
System.out.println(mat.name().toLowerCase()); if(debug) {
System.out.println("======= ALL MATERIALS ======");
for(Material mat : Material.values()) {
System.out.println(mat.name().toLowerCase());
}
System.out.println("============================");
} }
createConfig(); createConfig();
saveDefaultCategories(); saveDefaultCategories();
messages = new JeffChestSortMessages(this); messages = new JeffChestSortMessages(this);

View File

@ -1,7 +1,3 @@
# Names have to match exactly, except one exception:
# Color names HAVE to be ommited!
# Do not write white_bed, but just bed.
# Lines starting with a hashtag are ignored.
diamond diamond
emerald emerald
diamond_ore diamond_ore

View File

@ -1,23 +1,7 @@
diamond_pickaxe pickaxe
diamond_shovel shovel
diamond_axe hoe
diamond_hoe axe
iron_pickaxe
iron_shovel
iron_axe
iron_hoe
gold_pickaxe
gold_shovel
gold_axe
gold_hoe
stone_pickaxe
stone_shovel
stone_axe
stone_hoe
wooden_pickaxe
wooden_shovel
wooden_axe
wooden_hoe
flint_and_steel flint_and_steel
fishing_rod fishing_rod
compass compass