Skip to content

Commit

Permalink
update for core 'ObjectTag' rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 13, 2019
1 parent 11e0e45 commit dee78cd
Show file tree
Hide file tree
Showing 404 changed files with 4,352 additions and 4,353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@
public class CommonRegistries {

// <--[language]
// @name dObjects
// @name ObjectTags
// @group Object System
// @description
// dObjects are a system put into place by Denizen that make working with things, or 'objects',
// ObjectTags are a system put into place by Denizen that make working with things, or 'objects',
// in Minecraft and Denizen easier. Many parts of scripts will require some kind of object as an
// argument, identifier/type, or such as in world events, part of an event name. The dObjects notation
// argument, identifier/type, or such as in world events, part of an event name. The ObjectTags notation
// system helps both you and Denizen know what type of objects are being referenced and worked with.
//
// So when should you use dObjects? In arguments, event names, replaceable tags, configs, flags, and
// So when should you use ObjectTags? In arguments, event names, replaceable tags, configs, flags, and
// more! If you're just a beginner, you've probably been using them without even realizing it!
//
// dObject is a broader term for a 'type' of object that more specifically represents something,
// ObjectTag is a broader term for a 'type' of object that more specifically represents something,
// such as a dLocation or dScript, often times just referred to as a 'location' or 'script'. Denizen
// employs many object types that you should be familiar with. You'll notice that many times objects
// are reference with their 'dObject notation' which is in the format of 'x@', the x being the specific
// notation of an object type. Example: player objects use the p@ notation, and locations use l@.
// The use of this notation is encouraged, but not always required.
//
// Let's take the tag system, for example. It uses the dObjects system pretty heavily. For instance,
// every time you use <player.name> or <npc.id>, you're using a dObject, which brings us to a simple
// Let's take the tag system, for example. It uses the ObjectTags system pretty heavily. For instance,
// every time you use <player.name> or <npc.id>, you're using a ObjectTag, which brings us to a simple
// clarification: Why <player.name> and not <p@player.name>? That's because Denizen allows Players,
// NPCs and other 'in-context objects' to be linked to certain scripts. In short, <player> already
// contains a reference to a specific player, such as the player that died in a world event 'on player dies'.
// <p@player.name> would incorrectly reference the player named 'player', however this format is often
// used to help with usage of a tag, simply indicating 'any player object'.
//
// dObjects can be used to CREATE new instances of objects, too! Though not all types allow 'new'
// ObjectTags can be used to CREATE new instances of objects, too! Though not all types allow 'new'
// objects to be created, many do, such as dItems. With the use of tags, it's easy to reference a specific
// item, say -- an item in the Player's hand -- items are also able to use a constructor to make a new item,
// and say, drop it in the world. Take the case of the command/usage '- drop i@diamond_ore'. The item object
// used is a brand new diamond_ore, which is then dropped by the command to a location of your choice -- just
// specify an additional location argument.
//
// There's a great deal more to learn about dObjects, so be sure to check out each object type for more
// specific information. While all dObjects share some features, many contain goodies on top of that!
// There's a great deal more to learn about ObjectTags, so be sure to check out each object type for more
// specific information. While all ObjectTags share some features, many contain goodies on top of that!
//
// Here's an overview of each object type that is implemented by the Denizen core:
//
Expand Down Expand Up @@ -135,7 +135,7 @@ public class CommonRegistries {
// | object notation: trade@ can reference unique objects: no can be notable: no
// | trade@trade - represents a generic, customizable merchant trade to be used with merchant trade properties (See <@link language Merchant Trades>)
//
// + ----- dList -------+
// + ----- ListTag -------+
// | object notation: li@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | li@<items|...> - fetches a new list with the elements specified, separated by a pipe (|) character
Expand All @@ -156,7 +156,7 @@ public class CommonRegistries {
// | constructors: ( <>'s represent non-static information and are not literal)
// | pl@<plugin_name> - fetches the plugin with the specified name
//
// + ----- Element ------+
// + ----- ElementTag ------+
// | object notation: el@ can reference unique objects: no can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | el@<value> - fetches an element with the specified value
Expand Down
6 changes: 3 additions & 3 deletions plugin/src/main/java/com/denizenscript/denizen/Denizen.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import com.denizenscript.denizencore.DenizenCore;
import com.denizenscript.denizencore.events.OldEventManager;
import com.denizenscript.denizencore.objects.ObjectFetcher;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.ScriptBuilder;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.ScriptHelper;
Expand Down Expand Up @@ -350,7 +350,7 @@ public void onEnable() {

CommonRegistries.registerMainObjects();

// Register Core dObjects with the ObjectFetcher
// Register Core ObjectTags with the ObjectFetcher
ObjectFetcher._registerCoreObjects();
}
catch (Exception e) {
Expand Down Expand Up @@ -456,7 +456,7 @@ public void onDisable() {
// None.
//
// -->
HashMap<String, dObject> context = new HashMap<>();
HashMap<String, ObjectTag> context = new HashMap<>();
OldEventManager.doEvents(Arrays.asList("shutdown"), new BukkitScriptEntryData(null, null), context);

// Disable the log interceptor... otherwise bad things on /reload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.denizenscript.denizen.nms.NMSVersion;
import com.denizenscript.denizencore.DenizenImplementation;
import com.denizenscript.denizencore.objects.Argument;
import com.denizenscript.denizencore.objects.dList;
import com.denizenscript.denizencore.objects.ListTag;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.denizenscript.denizencore.scripts.ScriptHelper;
Expand Down Expand Up @@ -237,16 +237,16 @@ public String scriptQueueSpeed() {
}

@Override
public dList valueOfFlagdList(String string) {
public ListTag valueOfFlagListTag(String string) {
FlagManager.Flag flag = DenizenAPI.getCurrentInstance().getFlag(string);
if (flag == null) {
return null;
}
return new dList(flag.toString(), true, flag.values());
return new ListTag(flag.toString(), true, flag.values());
}

@Override
public boolean matchesFlagdList(String arg) {
public boolean matchesFlagListTag(String arg) {
boolean flag = false;
if (arg.startsWith("fl")) {
if (arg.indexOf('[') == 2) {
Expand Down Expand Up @@ -343,7 +343,7 @@ else if (comparedto.equalsIgnoreCase("material")) {
outcome = dMaterial.matches(comparable);
}
else if (comparedto.equalsIgnoreCase("materiallist")) {
outcome = dList.valueOf(comparable).containsObjectsFrom(dMaterial.class);
outcome = ListTag.valueOf(comparable).containsObjectsFrom(dMaterial.class);
}
else if (comparedto.equalsIgnoreCase("entity")) {
outcome = dEntity.matches(comparable);
Expand Down
10 changes: 5 additions & 5 deletions plugin/src/main/java/com/denizenscript/denizen/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.denizenscript.denizen.utilities.DenizenAPI;
import com.denizenscript.denizen.utilities.debugging.Debug;
import com.denizenscript.denizencore.objects.Duration;
import com.denizenscript.denizencore.objects.DurationTag;
import com.denizenscript.denizencore.scripts.ScriptHelper;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.configuration.file.FileConfiguration;
Expand Down Expand Up @@ -68,7 +68,7 @@ public static void refillCache() {
cache_chatGloballyIfNoChatTriggers = config.getBoolean("Triggers.Chat.Appears globally.If triggers missing", true);
cache_chatGloballyIfUninteractable = config.getBoolean("Triggers.Chat.Appears globally.If NPC uninteractable", true);
cache_worldScriptChatEventAsynchronous = config.getBoolean("Scripts.World.Events.On player chats.Use asynchronous event", false);
cache_worldScriptTimeEventFrequency = Duration.valueOf(config.getString("Scripts.World.Events.On time changes.Frequency of check", "250t"));
cache_worldScriptTimeEventFrequency = DurationTag.valueOf(config.getString("Scripts.World.Events.On time changes.Frequency of check", "250t"));
cache_blockTagsMaxBlocks = config.getInt("Tags.Block tags.Max blocks", 1000000);
cache_chatHistoryMaxMessages = config.getInt("Tags.Chat history.Max messages", 10);
cache_tagTimeout = config.getInt("Tags.Timeout", 10);
Expand Down Expand Up @@ -99,7 +99,7 @@ public static void refillCache() {

private static double cache_chatBystandersRange, cache_chatToNpcOverhearingRange;

private static Duration cache_worldScriptTimeEventFrequency;
private static DurationTag cache_worldScriptTimeEventFrequency;

/*
Expand Down Expand Up @@ -208,7 +208,7 @@ public static boolean triggerEnabled(String triggerName) {
*/

public static double triggerDefaultCooldown(String triggerName) {
return Duration.valueOf(DenizenAPI.getCurrentInstance().getConfig()
return DurationTag.valueOf(DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase()
+ CoreUtilities.toLowerCase(triggerName.substring(1)) + ".Cooldown", "5s")).getSeconds();
}
Expand Down Expand Up @@ -433,7 +433,7 @@ public static boolean worldScriptChatEventAsynchronous() {
*/

public static Duration worldScriptTimeEventFrequency() {
public static DurationTag worldScriptTimeEventFrequency() {
return cache_worldScriptTimeEventFrequency;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -84,7 +84,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -69,7 +69,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.denizenscript.denizen.utilities.debugging.Debug;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.ArgumentHelper;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -104,7 +104,7 @@ else if (dItem.matches(determination)) {
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -67,7 +67,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -70,7 +70,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -67,7 +67,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -76,7 +76,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.Element;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ElementTag;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand All @@ -31,7 +31,7 @@ public class BlockIgnitesScriptEvent extends BukkitScriptEvent implements Listen
// <context.material> returns the dMaterial of the block that was set on fire.
// <context.entity> returns the dEntity of the entity that ignited the block.
// <context.origin_location> returns the dLocation of the fire block that ignited this block.
// <context.cause> returns an Element of the cause of the event: ENDER_CRYSTAL, EXPLOSION, FIREBALL, FLINT_AND_STEEL, LAVA, or SPREAD.
// <context.cause> returns an ElementTag of the cause of the event: ENDER_CRYSTAL, EXPLOSION, FIREBALL, FLINT_AND_STEEL, LAVA, or SPREAD.
//
// -->

Expand All @@ -44,7 +44,7 @@ public BlockIgnitesScriptEvent() {
public dMaterial material;
public dEntity entity;
public dLocation origin_location;
public Element cause;
public ElementTag cause;
public BlockIgniteEvent event;

@Override
Expand Down Expand Up @@ -75,7 +75,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public void onBlockIgnites(BlockIgniteEvent event) {
if (event.getIgnitingBlock() != null) { // TODO: Why would this be null?
origin_location = new dLocation(event.getIgnitingBlock().getLocation());
}
cause = new Element(event.getCause().toString());
cause = new ElementTag(event.getCause().toString());
this.event = event;
fire(event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.utilities.MaterialCompat;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.Material;
Expand Down Expand Up @@ -75,7 +75,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.denizenscript.denizen.objects.dLocation;
import com.denizenscript.denizen.objects.dMaterial;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -71,7 +71,7 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public dObject getContext(String name) {
public ObjectTag getContext(String name) {
if (name.equals("location")) {
return location;
}
Expand Down
Loading

0 comments on commit dee78cd

Please sign in to comment.