Some more sounds functionality
This commit is contained in:
@@ -37,7 +37,7 @@ public abstract class ParamInfo {
|
||||
public ParamInfo(Class paramClass, String name, String descriptiveName, String description, Enum[] possibleValues) {
|
||||
this(paramClass, name, descriptiveName, description);
|
||||
|
||||
this.possibleValues = new HashMap<>();
|
||||
this.possibleValues = new LinkedHashMap<>();
|
||||
|
||||
for (Enum anEnum : possibleValues) {
|
||||
this.getValues().put(anEnum.name(), anEnum);
|
||||
@@ -52,7 +52,7 @@ public abstract class ParamInfo {
|
||||
Map<String, Object> possibleValues) {
|
||||
this(paramClass, name, descriptiveName, description);
|
||||
|
||||
this.possibleValues = new HashMap<>();
|
||||
this.possibleValues = new LinkedHashMap<>();
|
||||
this.possibleValues.putAll(possibleValues);
|
||||
}
|
||||
|
||||
|
@@ -35,11 +35,7 @@ public class ParamInfoTypes {
|
||||
}
|
||||
|
||||
public ParamInfoSoundGroup getParamInfoSoundGroup() {
|
||||
HashMap<String, Object> possibleSoundGroups = new HashMap<>();
|
||||
|
||||
SoundGroup.getGroups().keySet().forEach(key -> possibleSoundGroups.put(key, key));
|
||||
|
||||
return new ParamInfoSoundGroup(possibleSoundGroups);
|
||||
return new ParamInfoSoundGroup();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,14 +1,35 @@
|
||||
package me.libraryaddict.disguise.utilities.params.types.custom;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.params.types.ParamInfoEnum;
|
||||
import me.libraryaddict.disguise.utilities.sounds.SoundGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
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);
|
||||
public ParamInfoSoundGroup() {
|
||||
super(String.class, "SoundGroup", "A group of sounds", new HashMap<>());
|
||||
|
||||
recalculate();
|
||||
}
|
||||
|
||||
public void recalculate() {
|
||||
LinkedHashMap<String, Object> possibleSoundGroups = new LinkedHashMap<>();
|
||||
|
||||
ArrayList<String> list = new ArrayList<>(SoundGroup.getGroups().keySet());
|
||||
|
||||
list.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (String s : list) {
|
||||
possibleSoundGroups.put(s, SoundGroup.getGroup(s));
|
||||
}
|
||||
|
||||
getValues().clear();
|
||||
getValues().putAll(possibleSoundGroups);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user