mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
Extra check when loading MMOItemTriggers
This commit is contained in:
parent
3f5ad1a883
commit
ddb7468db1
@ -25,9 +25,9 @@ public class MMOItemTrigger extends Trigger {
|
||||
Validate.isTrue(MMOItems.plugin.getTypes().has(format), "Could not find item type " + format);
|
||||
type = MMOItems.plugin.getTypes().get(format);
|
||||
|
||||
id = config.getString("id");
|
||||
id = config.getString("id").replace("-", "_").toUpperCase();
|
||||
amount = config.args().length > 0 ? Math.max(1, Integer.parseInt(config.args()[0])) : 1;
|
||||
Validate.isTrue(MMOItems.plugin.getItems().getItem(type, id) != null, "Could not find item id " + id);
|
||||
Validate.isTrue(MMOItems.plugin.getItems().exists(type, id), "Could not find item id " + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +71,11 @@ public class ItemManager extends BukkitRunnable {
|
||||
return item == null ? null : item.newBuilder().build();
|
||||
}
|
||||
|
||||
public boolean exists(Type type, String id) {
|
||||
if(type == null) return false;
|
||||
return type.getConfigFile().getConfig().contains(id.replace("-", "_").toUpperCase());
|
||||
}
|
||||
|
||||
/*
|
||||
* every two minutes, loops through any loaded item and uncaches any if they
|
||||
* have not been generated for more than 5 minutes.
|
||||
|
Loading…
Reference in New Issue
Block a user