This commit is contained in:
Xephi59 2015-07-31 00:23:30 +02:00
parent 8bd6618481
commit 9c42be39d8

View File

@ -22,9 +22,9 @@ import com.comphenix.attribute.Attributes.Operation;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils;
import fr.xephi.authme.api.API; import fr.xephi.authme.api.API;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.Utils;
public class FileCache { public class FileCache {
@ -217,9 +217,7 @@ public class FileCache {
boolean op = false; boolean op = false;
boolean flying = false; boolean flying = false;
Scanner reader = null; Scanner reader = new Scanner(file);
try {
reader = new Scanner(file);
int i = 0; int i = 0;
int a = 0; int a = 0;
@ -271,8 +269,7 @@ public class FileCache {
k++; k++;
} }
} }
try { ItemMeta meta = stacki[i].getItemMeta();
ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(stacki[i].getType());
if (!name.isEmpty()) { if (!name.isEmpty()) {
meta.setDisplayName(name); meta.setDisplayName(name);
} }
@ -285,8 +282,6 @@ public class FileCache {
} }
if (meta != null) if (meta != null)
stacki[i].setItemMeta(meta); stacki[i].setItemMeta(meta);
} catch (Exception e) {
}
i++; i++;
} else { } else {
stacka[a] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); stacka[a] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3])));
@ -296,8 +291,7 @@ public class FileCache {
k++; k++;
} }
} }
try { ItemMeta meta = stacka[a].getItemMeta();
ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(stacka[a].getType());
if (!name.isEmpty()) if (!name.isEmpty())
meta.setDisplayName(name); meta.setDisplayName(name);
if (!lores.isEmpty()) { if (!lores.isEmpty()) {
@ -309,18 +303,9 @@ public class FileCache {
} }
if (meta != null) if (meta != null)
stacki[i].setItemMeta(meta); stacki[i].setItemMeta(meta);
} catch (Exception e) {
}
a++; a++;
} }
} }
} catch (final Exception e) {
ConsoleLogger.showError("Error on creating a file cache for " + player.getName() + ", maybe wipe inventory...");
} finally {
if (reader != null) {
reader.close();
}
}
return new DataFileCache(stacki, stacka, group, op, flying); return new DataFileCache(stacki, stacka, group, op, flying);
} else { } else {
// NEW METHOD // NEW METHOD