1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-15 02:59:06 +02:00

[trunk] case insensitive items from items csv when using /item and /give

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1198 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
ementalo
2011-04-15 21:11:41 +00:00
parent f1383bad05
commit be51bc1938

View File

@@ -65,8 +65,8 @@ public class ItemDb
int numeric = Integer.parseInt(parts[1]);
durabilities.put(parts[0], parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
items.put(parts[0], numeric);
durabilities.put(parts[0].toLowerCase(), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
items.put(parts[0].toLowerCase(), numeric);
}
catch (Exception ex)
{
@@ -81,7 +81,7 @@ public class ItemDb
}
public static ItemStack get(String id, int quantity) throws Exception {
ItemStack retval = get(id);
ItemStack retval = get(id.toLowerCase());
retval.setAmount(quantity);
return retval;
}
@@ -90,7 +90,7 @@ public class ItemDb
{
ItemStack retval = new ItemStack(getUnsafe(id));
retval.setAmount(Essentials.getSettings().getDefaultStackSize());
retval.setDurability(durabilities.containsKey(id) ? durabilities.get(id) : 0);
retval.setDurability(durabilities.containsKey(id.toLowerCase()) ? durabilities.get(id.toLowerCase()) : 0);
if (items.containsValue(retval.getTypeId()) || true) return retval;
throw new Exception("Unknown item numeric: " + retval);
}
@@ -103,7 +103,7 @@ public class ItemDb
}
catch (NumberFormatException ex)
{
if (items.containsKey(id)) return items.get(id);
if (items.containsKey(id.toLowerCase())) return items.get(id.toLowerCase());
throw new Exception("Unknown item name: " + id);
}
}