Permalink
Browse files

Add warning for deprecated tame_mob()

  • Loading branch information...
PseudoKnight committed Aug 5, 2018
1 parent ff30bd0 commit 6c566d7198c9ddff06e96e7d39ba06e68d0fb647
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/main/java/com/laytonsmith/core/functions/MobManagement.java
@@ -26,9 +26,13 @@
import com.laytonsmith.abstraction.enums.MCZombieType;
import com.laytonsmith.annotations.api;
import com.laytonsmith.annotations.hide;
import com.laytonsmith.core.CHLog;
import com.laytonsmith.core.CHVersion;
import com.laytonsmith.core.ObjectGenerator;
import com.laytonsmith.core.Optimizable;
import com.laytonsmith.core.ParseTree;
import com.laytonsmith.core.Static;
import com.laytonsmith.core.compiler.FileOptions;
import com.laytonsmith.core.constructs.CArray;
import com.laytonsmith.core.constructs.CBoolean;
import com.laytonsmith.core.constructs.CDouble;
@@ -57,8 +61,11 @@
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class MobManagement {
@@ -172,7 +179,7 @@ public Construct exec(Target t, Environment env, Construct... args) throws Cance
@api(environments = {CommandHelperEnvironment.class})
@hide("Deprecated")
public static class tame_mob extends AbstractFunction {
public static class tame_mob extends AbstractFunction implements Optimizable {
@Override
public String getName() {
@@ -246,6 +253,18 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
throw new CREUntameableMobException("The specified entity is not tameable", t);
}
}
@Override
public ParseTree optimizeDynamic(Target t, List<ParseTree> children, FileOptions fileOptions)
throws ConfigCompileException, ConfigRuntimeException {
CHLog.GetLogger().w(CHLog.Tags.DEPRECATION, "The function tame_mob() is deprecated for set_mob_owner().", t);
return null;
}
@Override
public Set<OptimizationOption> optimizationOptions() {
return EnumSet.of(OptimizationOption.OPTIMIZE_DYNAMIC);
}
}
@api

0 comments on commit 6c566d7

Please sign in to comment.