Skip to content

Commit

Permalink
command script container: parse tags in aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 25, 2023
1 parent 4293f40 commit d04d11e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Expand Up @@ -4,6 +4,7 @@
import com.denizenscript.denizen.nms.NMSVersion;
import com.denizenscript.denizen.objects.ItemTag;
import com.denizenscript.denizen.objects.properties.bukkit.BukkitColorExtensions;
import com.denizenscript.denizen.utilities.Utilities;
import com.denizenscript.denizencore.objects.core.*;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import com.denizenscript.denizencore.objects.Mechanism;
Expand Down Expand Up @@ -82,7 +83,7 @@ public ListTag getMapTagData(boolean includeExtras) {
if (isPotion()) {
PotionMeta meta = getPotionMeta();
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_20)) {
base.putObject("base_type", new ElementTag(meta.getBasePotionType().getKey().getKey()));
base.putObject("base_type", new ElementTag(Utilities.namespacedKeyToString(meta.getBasePotionType().getKey())));
}
if (includeExtras) { // TODO: Eventually remove these 3.
base.putObject("type", new ElementTag(meta.getBasePotionData().getType()));
Expand Down Expand Up @@ -460,7 +461,7 @@ public void adjust(Mechanism mechanism) {
MapTag baseEffect = firstObj.asType(MapTag.class, mechanism.context);
if (baseEffect.getObject("base_type") != null) {
ElementTag baseTypeElement = baseEffect.getElement("base_type");
type = Registry.POTION.get(NamespacedKey.minecraft(baseTypeElement.asLowerString()));
type = Registry.POTION.get(Utilities.parseNamespacedKey(baseTypeElement.asLowerString()));
if (type == null && baseTypeElement.matchesEnum(PotionType.class)) {
type = baseTypeElement.asEnum(PotionType.class);
}
Expand Down
Expand Up @@ -187,15 +187,15 @@ public String getDescription() {
// Replace new lines with a space and a new line, to allow full brief descriptions in /help.
// Without this, "line<n>line"s brief description would be "lin", because who doesn't like
// random cutoff-
return TagManager.tag((getString("description", "")).replace("\n", " \n"), new BukkitTagContext(null, null, new ScriptTag(this)));
return getString("description", "", true).replace("\n", " \n");
}

public String getUsage() {
return TagManager.tag((getString("usage", "")), new BukkitTagContext(null, null, new ScriptTag(this)));
return getString("usage", "", true);
}

public List<String> getAliases() {
List<String> aliases = getStringList("aliases");
List<String> aliases = getStringList("aliases", true);
return aliases != null ? aliases : new ArrayList<>();
}

Expand Down

0 comments on commit d04d11e

Please sign in to comment.