Skip to content

Update Examples to Reflect Alias Changes #7828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 1, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,14 @@ public String toVariableNameString(final WeatherType o) {
Classes.registerClass(new ClassInfo<>(ItemType.class, "itemtype")
.user("item ?types?", "materials?")
.name("Item Type")
.description("An item type is an alias, e.g. 'a pickaxe', 'all plants', etc., and can result in different items when added to an inventory, " +
.description("An item type is an alias that can result in different items when added to an inventory, " +
"and unlike <a href='#itemstack'>items</a> they are well suited for checking whether an inventory contains a certain item or whether a certain item is of a certain type.",
"An item type can also have one or more <a href='#enchantmenttype'>enchantments</a> with or without a specific level defined, " +
"and can optionally start with 'all' or 'every' to make this item type represent <i>all</i> types that the alias represents, including data ranges.")
.usage("[&lt;number&gt; [of]] [all/every] &lt;alias&gt; [of &lt;enchantment&gt; [&lt;level&gt;] [,/and &lt;more enchantments...&gt;]]")
.examples("give 4 torches to the player",
"add all slabs to the inventory of the block",
"add tag values of minecraft tag \"slabs\" to the inventory of the block",
"player's tool is a diamond sword of sharpness",
"remove a pickaxes of fortune 4 from {stored items::*}",
"set {_item} to 10 of every upside-down stair",
"block is dirt or farmland")
.since("1.0")
.before("itemstack", "entitydata", "entitytype")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Name("Is Edible")
@Description("Checks whether an item is edible.")
@Examples({
"steak is edible",
"cooked beef is edible",
"player's tool is edible"
})
@Since("2.2-dev36")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
*/
@Name("Is Enchanted")
@Description("Checks whether an item is enchanted.")
@Examples({"tool of the player is enchanted with efficiency 2",
"helm, chestplate, leggings or boots are enchanted"})
@Examples("tool of the player is enchanted with efficiency 2")
@Since("1.4.6")
public class CondIsEnchanted extends Condition {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Name("Is Flammable")
@Description("Checks whether an item is flammable.")
@Examples({
"wood is flammable",
"send whether the tag contents of minecraft tag \"planks\" are flammable",
"player's tool is flammable"
})
@Since("2.2-dev36")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
@Description("Checks whether an entity is wearing some items (usually armor).")
@Examples({
"player is wearing an iron chestplate and iron leggings",
"player is wearing all diamond armour",
"target is wearing wolf armor"
})
@Since("1.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Description("Checks whether a player is holding a specific item. Cannot be used with endermen, use 'entity is [not] an enderman holding &lt;item type&gt;' instead.")
@Examples({
"player is holding a stick",
"victim isn't holding a sword of sharpness"
"victim isn't holding a diamond sword of sharpness"
})
@Since("1.0")
public class CondItemInHand extends Condition {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ch/njol/skript/effects/EffEquip.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
})
@Examples({
"equip player with diamond helmet",
"equip player with all diamond armor",
"equip player with diamond leggings, diamond chestplate, and diamond boots",
"unequip diamond chestplate from player",
"unequip all armor from player",
"unequip player's armor"
})
@Since("1.0, 2.7 (multiple entities, unequip), 2.10 (wolves)")
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ch/njol/skript/events/EvtBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ public class EvtBlock extends SkriptEvent {
// REMIND attacking an item frame first removes its item; include this in on block damage?
Skript.registerEvent("Break / Mine", EvtBlock.class, new Class[]{BlockBreakEvent.class, PlayerBucketFillEvent.class, HangingBreakEvent.class}, "[block] (break[ing]|1¦min(e|ing)) [[of] %-itemtypes/blockdatas%]")
.description("Called when a block is broken by a player. If you use 'on mine', only events where the broken block dropped something will call the trigger.")
.examples("on mine:", "on break of stone:", "on mine of any ore:", "on break of chest[facing=north]:", "on break of potatoes[age=7]:")
.examples("on mine:", "on break of stone:", "on break of chest[facing=north]:", "on break of potatoes[age=7]:")
.since("1.0 (break), <i>unknown</i> (mine), 2.6 (BlockData support)");
Skript.registerEvent("Burn", EvtBlock.class, BlockBurnEvent.class, "[block] burn[ing] [[of] %-itemtypes/blockdatas%]")
.description("Called when a block is destroyed by fire.")
.examples("on burn:", "on burn of wood, fences, or chests:", "on burn of oak_log[axis=y]:")
.examples("on burn:", "on burn of oak wood, oak fences, or chests:", "on burn of oak_log[axis=y]:")
.since("1.0, 2.6 (BlockData support)");
Skript.registerEvent("Place", EvtBlock.class, new Class[]{BlockPlaceEvent.class, PlayerBucketEmptyEvent.class, HangingPlaceEvent.class}, "[block] (plac(e|ing)|build[ing]) [[of] %-itemtypes/blockdatas%]")
.description("Called when a player places a block.")
.examples("on place:", "on place of a furnace, workbench or chest:", "on break of chest[type=right] or chest[type=left]")
.examples("on place:", "on place of a furnace, crafting table or chest:", "on break of chest[type=right] or chest[type=left]")
.since("1.0, 2.6 (BlockData support)");
Skript.registerEvent("Fade", EvtBlock.class, BlockFadeEvent.class, "[block] fad(e|ing) [[of] %-itemtypes/blockdatas%]")
.description("Called when a block 'fades away', e.g. ice or snow melts.")
.examples("on fade of snow or ice:", "on fade of snow[layers=2]")
.examples("on fade of snow or blue ice:", "on fade of snow[layers=2]")
.since("1.0, 2.6 (BlockData support)");
Skript.registerEvent("Form", EvtBlock.class, BlockFormEvent.class, "[block] form[ing] [[of] %-itemtypes/blockdatas%]")
.description("Called when a block is created, but not by a player, e.g. snow forms due to snowfall, water freezes in cold biomes. This isn't called when block spreads (mushroom growth, water physics etc.), as it has its own event (see <a href='#spread'>spread event</a>).")
.examples("on form of snow:", "on form of a mushroom:")
.examples("on form of snow:")
.since("1.0, 2.6 (BlockData support)");
Skript.registerEvent("Block Drop", EvtBlock.class, BlockDropItemEvent.class, "block drop[ping] [[of] %-itemtypes/blockdatas%]")
.description(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/events/SimpleEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class SimpleEvents {
Skript.registerEvent("Block Damage", SimpleEvent.class, BlockDamageEvent.class, "block damag(ing|e)")
.description("Called when a player starts to break a block. You can usually just use the leftclick event for this.")
.examples("on block damaging:",
"\tif block is log:",
"\tif block is tagged with minecraft tag \"logs\":",
"\t\tsend \"You can't break the holy log!\"")
.since("1.0");
Skript.registerEvent("Flow", SimpleEvent.class, BlockFromToEvent.class, "[block] flow[ing]", "block mov(e|ing)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@Name("Amount of Items")
@Description("Counts how many of a particular <a href='./classes.html#itemtype'>item type</a> are in a given inventory.")
@Examples("message \"You have %number of ores in the player's inventory% ores in your inventory.\"")
@Examples("message \"You have %number of tag values of minecraft tag \"diamond_ores\" in the player's inventory% diamond ores in your inventory.\"")
@Since("2.0")
public class ExprAmountOfItems extends SimpleExpression<Long> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
@Description("The items dropped by the piglin in a piglin bartering event.")
@Examples({
"on piglin barter:",
"\tif the bartering drops contain a jack-o-lantern:",
"\t\tremove jack-o-lantern from bartering output",
"\tif the bartering drops contain a jack o lantern:",
"\t\tremove jack o lantern from bartering output",
"\t\tbroadcast \"it's not halloween yet!\""
})
@Since("2.10")
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ch/njol/skript/expressions/ExprColorOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
})
@Examples({
"on click on wool:",
"\tmessage \"This wool block is <%color of block%>%color of block%<reset>!\"",
"\tset the color of the block to black"
"if event-block is tagged with minecraft tag \"wool\":",
"\tmessage \"This wool block is <%color of block%>%color of block%<reset>!\"",
"\tset the color of the block to black"
})
@Since("1.2, 2.10 (displays)")
public class ExprColorOf extends PropertyExpression<Object, Color> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@Examples({"give player diamond sword with damage value 100", "set player's tool to diamond hoe damaged by 250",
"give player diamond sword with damage 700 named \"BROKEN SWORD\"",
"set {_item} to diamond hoe with damage value 50 named \"SAD HOE\"",
"set target block of player to wool with data value 1", "set target block of player to potato plant with data value 7"})
"set target block of player to white wool with data value 1", "set target block of player to potatoes with data value 7"})
@Since("2.4")
public class ExprDamagedItem extends PropertyExpression<ItemType, ItemType> {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/expressions/ExprItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Name("Items")
@Description("Items or blocks of a specific type, useful for looping.")
@Examples({
"loop items of type ore and log:",
"loop tag values of minecraft tag \"diamond_ores\" and \"oak_logs\":",
"\tblock contains loop-item",
"\tmessage \"Theres at least one %loop-item% in this block\"",
"drop all blocks at the player # drops one of every block at the player"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/expressions/ExprTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
@Name("Tool")
@Description("The item an entity is holding in their main or off hand.")
@Examples({"player's tool is a pickaxe",
@Examples({"player's tool is tagged with minecraft tag \"pickaxes\"",
"player's off hand tool is a shield",
"set tool of all players to a diamond sword",
"set offhand tool of target entity to a bow"})
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/expressions/ExprXOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@Name("X of Item")
@Description("An expression to be able to use a certain amount of items where the amount can be any expression. Please note that this expression is not stable and might be replaced in the future.")
@Examples("give level of player of pickaxes to the player")
@Examples("give level of player of iron pickaxes to the player")
@Since("1.2")
public class ExprXOf extends PropertyExpression<Object, Object> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"\tset loot table of block at event-location to \"minecraft:chests/simple_dungeon\"",
"\t# the chest will now generate the loot of a simple dungeon when opened, because it is indeed a lootable block.",

"set block at event-location to wool block",
"set block at event-location to white wool",
"if block at event-location is lootable:",
"\t# uh oh, nothing will happen because a wool is not a lootable block."
})
Expand Down