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