Add ability to change the sounds for a disguise to whatever you like
This commit is contained in:
@@ -8,6 +8,7 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoItemBlock;
|
||||
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoSoundGroup;
|
||||
import me.libraryaddict.disguise.utilities.parser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.watchers.DisguiseMethods;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -25,6 +26,8 @@ public class ParamInfoManager {
|
||||
private static DisguiseMethods disguiseMethods;
|
||||
@Getter
|
||||
private static ParamInfoItemBlock paramInfoItemBlock;
|
||||
@Getter
|
||||
private static ParamInfoSoundGroup paramInfoSoundGroup;
|
||||
|
||||
public static List<ParamInfo> getParamInfos() {
|
||||
return paramList;
|
||||
@@ -45,6 +48,10 @@ public class ParamInfoManager {
|
||||
}
|
||||
|
||||
public static ParamInfo getParamInfo(Method method) {
|
||||
if (method.getName().equals("setSoundGroup")) {
|
||||
return getParamInfoSoundGroup();
|
||||
}
|
||||
|
||||
if (method.getDeclaringClass() == FallingBlockWatcher.class &&
|
||||
method.getParameterTypes()[0] == ItemStack.class) {
|
||||
return getParamInfoItemBlock();
|
||||
@@ -84,6 +91,7 @@ public class ParamInfoManager {
|
||||
ParamInfoTypes infoTypes = new ParamInfoTypes();
|
||||
paramList = infoTypes.getParamInfos();
|
||||
paramInfoItemBlock = infoTypes.getParamInfoBlock();
|
||||
paramInfoSoundGroup = infoTypes.getParamInfoSoundGroup();
|
||||
disguiseMethods = new DisguiseMethods();
|
||||
|
||||
//paramList.sort((o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName()));
|
||||
@@ -112,7 +120,7 @@ public class ParamInfoManager {
|
||||
// Add these last as it's what we want to present to be called the least
|
||||
for (String methodName : new String[]{"setSelfDisguiseVisible", "setHideHeldItemFromSelf",
|
||||
"setHideArmorFromSelf", "setHearSelfDisguise", "setHidePlayer", "setExpires", "setNotifyBar",
|
||||
"setBossBarColor", "setBossBarStyle", "setTallDisguisesVisible", "setDynamicName"}) {
|
||||
"setBossBarColor", "setBossBarStyle", "setTallDisguisesVisible", "setDynamicName", "setSoundGroup"}) {
|
||||
try {
|
||||
Class cl = boolean.class;
|
||||
|
||||
@@ -129,6 +137,9 @@ public class ParamInfoManager {
|
||||
case "setBossBarStyle":
|
||||
cl = BarStyle.class;
|
||||
break;
|
||||
case "setSoundGroup":
|
||||
cl = String.class;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import me.libraryaddict.disguise.utilities.params.types.ParamInfoEnum;
|
||||
import me.libraryaddict.disguise.utilities.params.types.base.*;
|
||||
import me.libraryaddict.disguise.utilities.params.types.custom.*;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import me.libraryaddict.disguise.utilities.sounds.SoundGroup;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -33,6 +34,14 @@ public class ParamInfoTypes {
|
||||
"An ItemStack compromised of Material,Amount,Glow. Only requires Material", getMaterials());
|
||||
}
|
||||
|
||||
public ParamInfoSoundGroup getParamInfoSoundGroup() {
|
||||
HashMap<String, Object> possibleSoundGroups = new HashMap<>();
|
||||
|
||||
SoundGroup.getGroups().keySet().forEach(key -> possibleSoundGroups.put(key, key));
|
||||
|
||||
return new ParamInfoSoundGroup(possibleSoundGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor values are listed here for continuity
|
||||
*/
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package me.libraryaddict.disguise.utilities.params.types.custom;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.params.types.ParamInfoEnum;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 23/05/2020.
|
||||
*/
|
||||
public class ParamInfoSoundGroup extends ParamInfoEnum {
|
||||
public ParamInfoSoundGroup(Map<String, Object> possibleValues) {
|
||||
super(String.class, "SoundGroup", "A group of sounds", possibleValues);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user