Skip to content

Commit

Permalink
initial example meta values for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 5, 2022
1 parent 6f37507 commit 489d277
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 21 deletions.
Expand Up @@ -35,6 +35,10 @@ public class CustomScriptEvent extends ScriptEvent {
// @Player When the command is used with a player link.
// @NPC When the command is used with an NPC link.
//
// @Example
// on custom event id:my_custom_event:
// - narrate <context.my_custom_info>
//
// -->

public static CustomScriptEvent instance;
Expand Down
Expand Up @@ -28,6 +28,18 @@ public class SystemTimeScriptEvent extends ScriptEvent {
// <context.hour> returns the exact hour of the system time.
// <context.minute> returns the exact minute of the system time.
//
// @Example
// on system time hourly:
// - announce "Whoa an hour passed!"
// @Example
// on system time 12:00:
// - announce "Whoa it's noon!"
// @Example
// on system time 03:00:
// - announce "Daily restart in 5 minutes!"
// - wait 5m
// - adjust <server> restart
//
// -->

public static SystemTimeScriptEvent instance;
Expand Down
Expand Up @@ -11,8 +11,6 @@
import com.denizenscript.denizencore.utilities.EnumHelper;
import com.denizenscript.denizencore.utilities.debugging.Debug;

import java.util.HashSet;

public class Argument implements Cloneable {

@Override
Expand Down
Expand Up @@ -19,6 +19,8 @@ public class DurationTag implements ObjectTag {
// @name DurationTag
// @prefix d
// @base ElementTag
// @ExampleTagBase duration[5m]
// @ExampleValues 1s,1m,5m,12h
// @format
// The identity format for DurationTags is the number of seconds, followed by an 's'.
//
Expand Down
Expand Up @@ -21,10 +21,12 @@

public class ElementTag implements ObjectTag {

// NOTE: Explicitly not example value
// <--[ObjectType]
// @name ElementTag
// @prefix el
// @base None
// @ExampleTagBase element[hello_world]
// @format
// Just the plain text of the element value, no prefix or formatting.
//
Expand Down
Expand Up @@ -27,10 +27,12 @@

public class ListTag implements List<String>, ObjectTag {

// NOTE: Explicitly not example value
// <--[ObjectType]
// @name ListTag
// @prefix li
// @base ElementTag
// @ExampleTagBase list[one|two]
// @format
// The identity format for ListTags is each item, one after the other, in order, separated by a pipe '|' symbol.
// For example, for a list of 'taco', 'potatoes', and 'cheese', it would be 'li@taco|potatoes|cheese|'
Expand Down
Expand Up @@ -14,12 +14,14 @@

import java.util.*;

public class MapTag implements ObjectTag, Adjustable {
public class MapTag implements ObjectTag {

// NOTE: Explicitly not example value
// <--[ObjectType]
// @name MapTag
// @prefix map
// @base ElementTag
// @ExampleTagBase map[key=value]
// @format
// The identity format for MapTags is a replica of property syntax - square brackets surrounded a semi-colon separated list of key=value pairs.
// For example, a map of "taco" to "food", "chicken" to "animal", and "bob" to "person" would be "map@[taco=food;chicken=animal;bob=person]"
Expand Down Expand Up @@ -776,14 +778,4 @@ public void appendDeepKeys(String path, ListTag result) {
public ObjectTag getObjectAttribute(Attribute attribute) {
return tagProcessor.getObjectAttribute(this, attribute);
}

@Override
public void applyProperty(Mechanism mechanism) {
Debug.echoError("MapTags can not hold properties.");
}

@Override
public void adjust(Mechanism mechanism) {
CoreUtilities.autoPropertyMechanism(this, mechanism);
}
}
Expand Up @@ -23,6 +23,8 @@ public class QueueTag implements ObjectTag, Adjustable, FlaggableObject {
// @prefix q
// @base ElementTag
// @implements FlaggableObject
// @ExampleTagBase queue
// @ExampleValues <queue>
// @format
// The identity format for queues is simply the queue ID.
//
Expand Down
Expand Up @@ -80,6 +80,8 @@ public class ScriptTag implements ObjectTag, Adjustable, FlaggableObject {
// @prefix s
// @base ElementTag
// @implements FlaggableObject
// @ExampleTagBase script
// @ExampleValues <script>
// @format
// The identity format for scripts is simply the script name.
//
Expand Down
Expand Up @@ -38,6 +38,8 @@ public static void load() {
// @name SecretTag
// @prefix secret
// @base ElementTag
// @ExampleTagBase secret[my_secret_key]
// @ExampleValues <secret[my_secret_key]>
// @format
// The identity format for secrets is simply the secret key (as defined by the file 'secrets.secret' in the Denizen folder).
//
Expand Down
Expand Up @@ -27,6 +27,8 @@ public class TimeTag implements ObjectTag, Adjustable, FlaggableObject {
// @prefix time
// @base ElementTag
// @implements FlaggableObject
// @ExampleTagBase util.time_now
// @ExampleValues <util.time_now>
// @format
// The identity format for TimeTags is "yyyy/mm/dd_hh:mm:ss:mill_offset"
// So, for example, 'time@2020/05/23_02:20:31:123_-07:00'
Expand Down
Expand Up @@ -7,7 +7,6 @@
import com.denizenscript.denizencore.DenizenCore;

import java.io.*;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;

Expand Down
Expand Up @@ -10,8 +10,6 @@
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntry;

import java.util.HashSet;

public class DebugCommand extends AbstractCommand implements Holdable {

public DebugCommand() {
Expand Down
Expand Up @@ -6,7 +6,6 @@
import com.denizenscript.denizencore.utilities.CoreConfiguration;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import com.denizenscript.denizencore.DenizenCore;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.commands.BracedCommand;
Expand Down
Expand Up @@ -14,7 +14,6 @@
import com.denizenscript.denizencore.utilities.ScriptUtilities;
import com.denizenscript.denizencore.utilities.codegen.TagNamer;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import com.denizenscript.denizencore.utilities.debugging.FutureWarning;

import java.util.HashMap;

Expand Down
Expand Up @@ -44,7 +44,9 @@ public void utilTag(ReplaceableTagEvent event) {
// @returns ElementTag(Number)
// @description
// 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.
// @Example
// # Will narrate '1', '2', or '3'
// - narrate <util.random.int[1].to[3]>
// -->
if (attribute.startsWith("int")) {
String stc = attribute.getParam();
Expand Down Expand Up @@ -73,7 +75,9 @@ public void utilTag(ReplaceableTagEvent event) {
// @returns ElementTag(Decimal)
// @description
// 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.
// @Example
// # Will narrate '1.5', or '1.75', or '1.01230123', or any other decimal in range.
// - narrate <util.random.decimal[1].to[2]>
// -->
if (attribute.startsWith("decimal")
&& attribute.hasParam()) {
Expand Down Expand Up @@ -183,7 +187,11 @@ else if (attribute.startsWith("random_decimal")) {
// @returns ElementTag(Boolean)
// @description
// Returns a random boolean (true or false) with the given percent chance (from 0 to 100).
// For example, <util.random_chance[25]> will return 'true' 25% of the time and 'false' 75% of the time.
// @Example
// - if <util.random_chance[25]>:
// - narrate "This happens 25% of the time"
// - else:
// - narrate "This happens 75% of the time"
// -->
else if (attribute.startsWith("random_chance") && attribute.hasParam()) {
event.setReplacedObject(CoreUtilities.autoAttrib(new ElementTag(CoreUtilities.getRandom().nextDouble() * 100 <= attribute.getDoubleParam()), attribute.fulfill(1)));
Expand Down Expand Up @@ -564,6 +572,7 @@ else if (attribute.startsWith("event_stats_data")) {
// @name system
// @prefix None
// @base None
// @ExampleAdjustObject system
// @format
// N/A
//
Expand Down

0 comments on commit 489d277

Please sign in to comment.