Skip to content

Commit

Permalink
rename objects to 'ObjectTag' form
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 13, 2019
1 parent 750369a commit 72577a3
Show file tree
Hide file tree
Showing 447 changed files with 7,384 additions and 7,394 deletions.
@@ -1,25 +1,25 @@
package com.denizenscript.denizen;

import com.denizenscript.denizen.objects.dNPC;
import com.denizenscript.denizen.objects.dPlayer;
import com.denizenscript.denizen.objects.NPCTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.tags.BukkitTagContext;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.denizenscript.denizencore.tags.TagContext;

public class BukkitScriptEntryData extends ScriptEntryData {
private dPlayer player;
private dNPC npc;
private PlayerTag player;
private NPCTag npc;

public BukkitScriptEntryData(dPlayer player, dNPC npc) {
public BukkitScriptEntryData(PlayerTag player, NPCTag npc) {
this.player = player;
this.npc = npc;
}

public dPlayer getPlayer() {
public PlayerTag getPlayer() {
return player;
}

public dNPC getNPC() {
public NPCTag getNPC() {
return npc != null && npc.getCitizen() != null ? npc : null;
}

Expand All @@ -31,11 +31,11 @@ public boolean hasPlayer() {
return player != null;
}

public void setPlayer(dPlayer player) {
public void setPlayer(PlayerTag player) {
this.player = player;
}

public void setNPC(dNPC npc) {
public void setNPC(NPCTag npc) {
this.npc = npc;
}

Expand Down
Expand Up @@ -20,22 +20,22 @@ public class CommonRegistries {
// more! If you're just a beginner, you've probably been using them without even realizing it!
//
// 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
// such as a LocationTag or ScriptTag, 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 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,
// clarification: Why <player.name> and not <PlayerTag.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
// <PlayerTag.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'.
//
// 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
// objects to be created, many do, such as ItemTags. 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
Expand All @@ -46,26 +46,26 @@ public class CommonRegistries {
//
// Here's an overview of each object type that is implemented by the Denizen core:
//
// + ----- dPlayer ----- +
// + ----- PlayerTag ----- +
// | object notation: p@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | p@<UUID> - fetches an online or offline player with the specified UUID
// | p@<player_name> - Outdated constructor for back-support, fetches by name instead of UUID
//
// + ----- dNPC ---------+
// + ----- NPCTag ---------+
// | object notation: n@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | n@<npc_id> - fetches the NPC with the specified ID
// | n@<npc_name> - fetches the first NPC found with the specified name
//
// + ----- dLocation ----+
// + ----- LocationTag ----+
// | object notation: l@ can reference unique objects: no can be notable: yes
// | constructors: ( <>'s represent non-static information and are not literal)
// | l@<x>,<y>,<z>,<world_name> - fetches a specific location
// | l@<x>,<y>,<z>,<pitch>,<yaw>,<world_name> - fetches a specific location and direction
// | l@<notable_location_name> - fetches the location that has been 'noted' with the specified ID
//
// + ----- dEntity ------+
// + ----- EntityTag ------+
// | object notation: e@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | e@<entity_type> - fetches a new entity with the specified type as implemented by Bukkit's entity type enumeration
Expand All @@ -74,44 +74,44 @@ public class CommonRegistries {
// | e@<entity_id> - fetches the entity that has the (temporary) entity ID set by Bukkit
// | e@random - fetches a new, random entity
//
// + ----- dItem --------+
// + ----- ItemTag --------+
// | object notation: i@ can reference unique objects: no can be notable: yes
// | constructors: ( <>'s represent non-static information and are not literal)
// | i@<material_name> - fetches a new item of the specified material
// | i@<material_name>,<data> - fetches a new item with the specified data (deprecated)
// | i@<item_script_name> - fetches a new custom item as specified by the referenced item script
// | i@<notable_name> - fetches the item that has been noted with the specified ID
//
// + ----- dWorld -------+
// + ----- WorldTag -------+
// | object notation: w@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | w@<world_name> - fetches the world with the specified name
//
// + ----- dColor -------+
// + ----- ColorTag -------+
// | object notation: co@ can reference unique objects: no can be notable: soon
// | constructors: ( <>'s represent non-static information and are not literal)
// | co@<color_name> - fetches a named color, as implemented by Bukkit's color enumeration
// | co@<r>,<g>,<b> - fetches a color made of the specified Red,Green,Blue value
// | co@random - fetches a random color
//
// + ----- dCuboid ------+
// + ----- CuboidTag ------+
// | object notation: cu@ can reference unique objects: no can be notable: yes
// | constructors: ( <>'s represent non-static information and are not literal)
// | cu@<position_1>|<position_2>|... - fetches a new cuboid encompassing a region from position 1 to 2, from 3 to 4, ...
// | cu@<notable_name> - fetches the cuboid that has been noted with the specified ID
//
// + ----- dEllipsoid ------+
// + ----- EllipsoidTag ------+
// | object notation: ellipsoid@ can reference unique objects: no can be notable: yes
// | constructors: ( <>'s represent non-static information and are not literal)
// | ellipsoid@<x>,<y>,<z>,<world>,<xrad>,<yrad>,<zrad> - fetches a new ellispoid at the position with the given radius
// | ellipsoid@<notable_name> - fetches the ellipsoid that has been noted with the specified ID
//
// + ----- dChunk ------+
// + ----- ChunkTag ------+
// | object notation: ch@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | ch@<x>,<y>,<world> - fetches a chunk at the given chunk location
//
// + ----- dInventory ---+
// + ----- InventoryTag ---+
// | object notation: in@ can reference unique objects: yes can be notable: yes
// | constructors: ( <>'s represent non-static information and are not literal)
// | in@player[holder=<player>] - fetches the specified Player's inventory (Works for offline players)
Expand All @@ -123,35 +123,35 @@ public class CommonRegistries {
// | in@<inventory_script_name> - fetches a new custom inventory as specified by the referenced inventory script
// | in@generic - represents a generic, customizable virtual inventory to be used with inventory properties (See <@link language Virtual Inventories>)
//
// + ----- dMaterial ----+
// + ----- MaterialTag ----+
// | object notation: m@ can reference unique objects: no can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | m@<material_name> - fetches the material as specified by Bukkit's material enumeration
// | m@<material_name>,<data> - fetches the material as specified by Bukkit's material enumeration with specified data (deprecated)
// | m@<data_variety_material> - fetches the material specified by Denizen's 'data variety' dMaterials (deprecated)
// | m@<data_variety_material> - fetches the material specified by Denizen's 'data variety' MaterialTags (deprecated)
// | m@random - fetches a random material
//
// + ----- dTrade -----+
// + ----- TradeTag -----+
// | 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>)
// | TradeTag - represents a generic, customizable merchant trade to be used with merchant trade properties (See <@link language Merchant Trades>)
//
// + ----- 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
//
// + ----- dScript -------+
// + ----- ScriptTag -------+
// | object notation: s@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | s@<script_container_name> - fetches the script container with the specified name
//
// + ----- Duration ------+
// + ----- DurationTag ------+
// | object notation: d@ can reference unique objects: no can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | d@<duration> - fetches a duration object with the specified amount of time
// | d@<low>-<high> - fetches a duration that is randomly selected between the specified 'low' and 'high'
//
// + ----- dPlugin -------+
// + ----- PluginTag -------+
// | object notation: pl@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | pl@<plugin_name> - fetches the plugin with the specified name
Expand All @@ -162,12 +162,12 @@ public class CommonRegistries {
// | el@<value> - fetches an element with the specified value
// | el@val[<value>] - slightly more verbose, but tag friendly way to fetch a new element (allows periods)
//
// + ----- Queue ------+
// + ----- QueueTag ------+
// | object notation: q@ can reference unique objects: yes can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | q@<id> - fetches the queue with the given ID
//
// + ----- Custom Object ------+
// + ----- CustomObjectTag ------+
// | object notation: custom@ can reference unique objects: no can be notable: no
// | constructors: ( <>'s represent non-static information and are not literal)
// | custom@<custom_script_name> - fetches a custom object of the specified base custom script.
Expand Down Expand Up @@ -209,31 +209,31 @@ public static void registerMainTagHandlers() {
}

public static void registerMainObjects() {
ObjectFetcher.registerWithObjectFetcher(dBiome.class); // b@
dBiome.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dChunk.class); // ch@
dChunk.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dColor.class); // co@
dColor.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dCuboid.class); // cu@
dCuboid.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dEllipsoid.class); // ellipsoid@
dEllipsoid.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dEntity.class); // e@
ObjectFetcher.registerWithObjectFetcher(dInventory.class); // in@
ObjectFetcher.registerWithObjectFetcher(dItem.class); // i@
dItem.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dLocation.class); // l@
ObjectFetcher.registerWithObjectFetcher(dMaterial.class); // m@
dMaterial.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(BiomeTag.class); // b@
BiomeTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(ChunkTag.class); // ch@
ChunkTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(ColorTag.class); // co@
ColorTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(CuboidTag.class); // cu@
CuboidTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(EllipsoidTag.class); // ellipsoid@
EllipsoidTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(EntityTag.class); // e@
ObjectFetcher.registerWithObjectFetcher(InventoryTag.class); // in@
ObjectFetcher.registerWithObjectFetcher(ItemTag.class); // i@
ItemTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(LocationTag.class); // l@
ObjectFetcher.registerWithObjectFetcher(MaterialTag.class); // m@
MaterialTag.registerTags(); // TODO: Automate this once all classes have tag registries
if (Depends.citizens != null) {
ObjectFetcher.registerWithObjectFetcher(dNPC.class); // n@
ObjectFetcher.registerWithObjectFetcher(NPCTag.class); // n@
}
ObjectFetcher.registerWithObjectFetcher(dPlayer.class); // p@
ObjectFetcher.registerWithObjectFetcher(dPlugin.class); // pl@
dPlugin.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(dTrade.class); // trade@
ObjectFetcher.registerWithObjectFetcher(dWorld.class); // w@
dWorld.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(PlayerTag.class); // p@
ObjectFetcher.registerWithObjectFetcher(PluginTag.class); // pl@
PluginTag.registerTags(); // TODO: Automate this once all classes have tag registries
ObjectFetcher.registerWithObjectFetcher(TradeTag.class); // trade@
ObjectFetcher.registerWithObjectFetcher(WorldTag.class); // w@
WorldTag.registerTags(); // TODO: Automate this once all classes have tag registries
}
}

0 comments on commit 72577a3

Please sign in to comment.