Permalink
Browse files

Catch duplicate recipe keys

  • Loading branch information...
PseudoKnight committed Dec 13, 2017
1 parent 74c4ca7 commit 4fc76c49565286f66f70c07a345d56b45fa137e2
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/main/java/com/laytonsmith/core/functions/Recipes.java
@@ -53,7 +53,12 @@ public Boolean runAsync() {
@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
return CBoolean.get(Static.getServer().addRecipe(ObjectGenerator.GetGenerator().recipe(args[0], t)));
try {
return CBoolean.get(Static.getServer().addRecipe(ObjectGenerator.GetGenerator().recipe(args[0], t)));
} catch(IllegalStateException ex) {
// recipe with the given key probably already exists
return CBoolean.FALSE;
}
}
@Override

0 comments on commit 4fc76c4

Please sign in to comment.