Enderman can't hold non-blocks, fixes #606
This commit is contained in:
parent
d20a8e5266
commit
69f3494633
@ -17,6 +17,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfo;
|
import me.libraryaddict.disguise.utilities.params.ParamInfo;
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
||||||
|
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoItemStack;
|
||||||
import me.libraryaddict.disguise.utilities.parser.DisguiseParser;
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParser;
|
||||||
import me.libraryaddict.disguise.utilities.parser.DisguisePerm;
|
import me.libraryaddict.disguise.utilities.parser.DisguisePerm;
|
||||||
import me.libraryaddict.disguise.utilities.parser.DisguisePermissions;
|
import me.libraryaddict.disguise.utilities.parser.DisguisePermissions;
|
||||||
@ -181,6 +182,11 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
|
|||||||
if (info != null && !info.isParam(boolean.class)) {
|
if (info != null && !info.isParam(boolean.class)) {
|
||||||
addMethods = false;
|
addMethods = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enderman can't hold non-blocks
|
||||||
|
if (disguisePerm.getType() == DisguiseType.ENDERMAN && prevArg.equalsIgnoreCase("setItemInMainHand")) {
|
||||||
|
info = ParamInfoManager.getParamInfoItemBlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the previous argument is a method
|
// If the previous argument is a method
|
||||||
|
@ -32,12 +32,17 @@ public class EndermanWatcher extends InsentientWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setItemInMainHand(Material type) {
|
public void setItemInMainHand(Material type) {
|
||||||
|
if (!type.isBlock()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Optional<WrappedBlockData> optional;
|
Optional<WrappedBlockData> optional;
|
||||||
|
|
||||||
if (type == null)
|
if (type == null) {
|
||||||
optional = Optional.empty();
|
optional = Optional.empty();
|
||||||
else
|
} else {
|
||||||
optional = Optional.of(WrappedBlockData.createData(type));
|
optional = Optional.of(WrappedBlockData.createData(type));
|
||||||
|
}
|
||||||
|
|
||||||
setData(MetaIndex.ENDERMAN_ITEM, optional);
|
setData(MetaIndex.ENDERMAN_ITEM, optional);
|
||||||
sendData(MetaIndex.ENDERMAN_ITEM);
|
sendData(MetaIndex.ENDERMAN_ITEM);
|
||||||
|
@ -3,6 +3,7 @@ package me.libraryaddict.disguise.utilities.params;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.watchers.EndermanWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||||
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoItemBlock;
|
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoItemBlock;
|
||||||
@ -50,6 +51,11 @@ public class ParamInfoManager {
|
|||||||
return getParamInfoSoundGroup();
|
return getParamInfoSoundGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enderman can't hold non-blocks
|
||||||
|
if (method.getWatcherClass() == EndermanWatcher.class && method.getName().equalsIgnoreCase("setItemInMainHand")) {
|
||||||
|
return getParamInfoItemBlock();
|
||||||
|
}
|
||||||
|
|
||||||
if (method.getWatcherClass() == FallingBlockWatcher.class && (method.getParam() == Material.class || method.getParam() == ItemStack.class)) {
|
if (method.getWatcherClass() == FallingBlockWatcher.class && (method.getParam() == Material.class || method.getParam() == ItemStack.class)) {
|
||||||
return getParamInfoItemBlock();
|
return getParamInfoItemBlock();
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,7 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class ParamInfoTypes {
|
public class ParamInfoTypes {
|
||||||
public ParamInfoItemBlock getParamInfoBlock() {
|
public ParamInfoItemBlock getParamInfoBlock() {
|
||||||
return new ParamInfoItemBlock(ItemStack.class, "ItemStack", "ItemStack (Material,Amount?,Glow?)",
|
return new ParamInfoItemBlock(ItemStack.class, "ItemStack", "ItemStack (Material)", "An ItemStack compromised of Material", getMaterials());
|
||||||
"An ItemStack compromised of Material,Amount,Glow. Only requires Material", getMaterials());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParamInfoSoundGroup getParamInfoSoundGroup() {
|
public ParamInfoSoundGroup getParamInfoSoundGroup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user