Skip to content

Commit

Permalink
untrainwreck the default_step tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 8, 2020
1 parent c1e23cd commit d9632ea
Showing 1 changed file with 4 additions and 5 deletions.
Expand Up @@ -70,15 +70,14 @@ public static void registerTags() {
});

// <--[tag]
// @attribute <ScriptTag.step[<player>]>
// @attribute <ScriptTag.step[(<player>)]>
// @returns ElementTag
// @description
// Returns the name of a script step that the player is currently on.
// Must be an INTERACT script.
// -->
PropertyParser.<BukkitScriptProperties>registerTag("step", (attribute, script) -> {
PlayerTag player = (attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class)
: ((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer());
PlayerTag player = attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) : ((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer();
if (player != null && player.isValid()) {
return new ElementTag(InteractScriptHelper.getCurrentStep(player, script.script.getContainer().getName()));
}
Expand All @@ -88,12 +87,12 @@ public static void registerTags() {
});

// <--[tag]
// @attribute <ScriptTag.default_name>
// @attribute <ScriptTag.default_step>
// @returns ElementTag
// @description
// Returns the name of the default step of an interact script.
// -->
PropertyParser.<BukkitScriptProperties>registerTag("step", (attribute, script) -> {
PropertyParser.<BukkitScriptProperties>registerTag("default_step", (attribute, script) -> {
String step = ((InteractScriptContainer) script.script.getContainer()).getDefaultStepName();
return new ElementTag(step);
});
Expand Down

0 comments on commit d9632ea

Please sign in to comment.