Cleanup 2

This commit is contained in:
Jules 2020-08-03 18:37:31 +02:00
parent c1401eb784
commit 8b108c1aa1

View File

@ -9,18 +9,18 @@ import net.mmogroup.mmolib.api.item.NBTItem;
public class VolatileMMOItem extends ReadMMOItem { public class VolatileMMOItem extends ReadMMOItem {
/* /*
* instead of loading all the item data directly when the constructor is * using VolatileMMOItem compared to LiveMMOItem, MMOItems only loads the item
* called, some systems do not require to know all the data from a specific * data it really NEEDS. the item data is only read when using hasData(ItemStat)
* item. therefore the data is only loaded when the stat is being checked on * for the first time, whereas LiveMMOItem reads everything on constructor ; it
* hasData() * is purely a performance concern
*/ */
public VolatileMMOItem(NBTItem item) { public VolatileMMOItem(NBTItem item) {
super(item); super(item);
} }
/* /*
* since it checks for the data every time this method is called, this * since it checks for the data every time this method is called, this method
* method must only be used once if we want the best performance * must only be called ONCE if we want the best performance
*/ */
@Override @Override
public boolean hasData(ItemStat stat) { public boolean hasData(ItemStat stat) {
@ -28,8 +28,8 @@ public class VolatileMMOItem extends ReadMMOItem {
try { try {
stat.whenLoaded(this); stat.whenLoaded(this);
} catch (IllegalArgumentException exception) { } catch (IllegalArgumentException exception) {
MMOItems.plugin.getLogger().log(Level.WARNING, MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load stat '" + stat.getId()
"Could not load stat '" + stat.getId() + "'item data from '" + getId() + "': " + exception.getMessage()); + "'item data from '" + getId() + "': " + exception.getMessage());
} }
return super.hasData(stat); return super.hasData(stat);
} }