Skip to content

Commit

Permalink
object_type instead of just type
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 8, 2021
1 parent aa2eec0 commit c6edf3b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Expand Up @@ -32,6 +32,7 @@ public class QueueTag implements ObjectTag, Adjustable, FlaggableObject {
//
// This object type is flaggable.
// Flags on this object type will be reinterpreted as definitions.
// Flags on queues should just not be used. Use definitions directly.
//
// -->

Expand All @@ -45,15 +46,12 @@ public static QueueTag valueOf(String string, TagContext context) {
if (string == null) {
return null;
}

if (string.startsWith("q@") && string.length() > 2) {
string = string.substring(2);
}

if (ScriptQueue.queueExists(string)) {
return new QueueTag(ScriptQueue.getExistingQueue(string));
}

return null;
}

Expand Down
Expand Up @@ -51,7 +51,6 @@ public static TimeTag valueOf(String string, TagContext context) {
if (string == null) {
return null;
}

if (string.startsWith("time@") && string.length() > "time@".length()) {
string = string.substring("time@".length());
}
Expand All @@ -63,7 +62,6 @@ public static TimeTag valueOf(String string, TagContext context) {
if (dateParts.size() != 3) {
return null;
}

List<String> timeParts = null;
if (coreParts.size() > 1) {
timeParts = CoreUtilities.split(coreParts.get(1), ':');
Expand Down
Expand Up @@ -26,15 +26,15 @@ public ObjectTagProcessor() {
});

// <--[tag]
// @attribute <ObjectTag.type>
// @attribute <ObjectTag.object_type>
// @returns ElementTag
// @description
// Returns the name of the tag type that is processing this tag, like 'List'.
// This tag is made available to help you debug script issues, for example if you think an object isn't processing its own type correctly.
// -->
registerTag("type", (attribute, object) -> {
registerTag("object_type", (attribute, object) -> {
return new ElementTag(object.getObjectType());
});
}, "type");
}

public void registerFutureTagDeprecation(String name, String... deprecatedVariants) {
Expand Down
Expand Up @@ -48,7 +48,7 @@ public void utilTag(ReplaceableTagEvent event) {
// @attribute <util.random.int[<#>].to[<#>]>
// @returns ElementTag(Number)
// @description
// Returns a random number between the 2 specified numbers, inclusive.
// Returns a random integer number between the 2 specified integer numbers, inclusive.
// For example: random.int[1].to[3] could return 1, 2, or 3.
// -->
if (attribute.startsWith("int")) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public void utilTag(ReplaceableTagEvent event) {
// @attribute <util.random.decimal[<#.#>].to[<#.#>]>
// @returns ElementTag(Decimal)
// @description
// Returns a random number between the 2 specified numbers, inclusive.
// Returns a random decimal number between the 2 specified decimal numbers, inclusive.
// For example: random.decimal[1].to[2] could return 1.5, 1.75, or a massive number of other options.
// -->
if (attribute.startsWith("decimal")
Expand Down Expand Up @@ -107,7 +107,7 @@ public void utilTag(ReplaceableTagEvent event) {
// @attribute <util.random.decimal>
// @returns ElementTag(Decimal)
// @description
// Returns a random decimal number from 0 to 1
// Returns a random decimal number from 0 to 1.
// -->
else if (attribute.startsWith("decimal")) {
event.setReplacedObject(CoreUtilities.autoAttrib(new ElementTag(CoreUtilities.getRandom().nextDouble())
Expand Down Expand Up @@ -166,7 +166,7 @@ else if (attribute.startsWith("duuid")) {
// @attribute <util.list_numbers_to[<#>]>
// @returns ListTag
// @description
// Returns a list of numbers from 1 to the specified input number (inclusive).
// Returns a list of integer numbers from 1 to the specified input number (inclusive).
// Note that you should NEVER use this as the input to a "foreach" command. Instead, use "repeat".
// In most cases, there's a better way to do what you're trying to accomplish than using this tag.
// -->
Expand Down

0 comments on commit c6edf3b

Please sign in to comment.