Java 7-ize this class

This commit is contained in:
vemacs 2016-03-10 12:36:57 -07:00
parent bdb81123d6
commit 97561667a0

View file

@ -23,10 +23,10 @@ import static com.earth2me.essentials.I18n.tl;
public class ItemDb implements IConf, net.ess3.api.IItemDb { public class ItemDb implements IConf, net.ess3.api.IItemDb {
private final transient IEssentials ess; private final transient IEssentials ess;
private final transient Map<String, Integer> items = new HashMap<String, Integer>(); private final transient Map<String, Integer> items = new HashMap<>();
private final transient Map<ItemData, List<String>> names = new HashMap<ItemData, List<String>>(); private final transient Map<ItemData, List<String>> names = new HashMap<>();
private final transient Map<ItemData, String> primaryName = new HashMap<ItemData, String>(); private final transient Map<ItemData, String> primaryName = new HashMap<>();
private final transient Map<String, Short> durabilities = new HashMap<String, Short>(); private final transient Map<String, Short> durabilities = new HashMap<>();
private final transient ManagedFile file; private final transient ManagedFile file;
private final transient Pattern splitPattern = Pattern.compile("((.*)[:+',;.](\\d+))"); private final transient Pattern splitPattern = Pattern.compile("((.*)[:+',;.](\\d+))");
@ -90,7 +90,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
@Override @Override
public ItemStack get(final String id) throws Exception { public ItemStack get(final String id) throws Exception {
int itemid = 0; int itemid = 0;
String itemname = null; String itemname;
short metaData = 0; short metaData = 0;
Matcher parts = splitPattern.matcher(id); Matcher parts = splitPattern.matcher(id);
if (parts.matches()) { if (parts.matches()) {
@ -160,7 +160,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
@Override @Override
public List<ItemStack> getMatching(User user, String[] args) throws Exception { public List<ItemStack> getMatching(User user, String[] args) throws Exception {
List<ItemStack> is = new ArrayList<ItemStack>(); List<ItemStack> is = new ArrayList<>();
if (args.length < 1) { if (args.length < 1) {
is.add(user.getBase().getItemInHand()); is.add(user.getBase().getItemInHand());