|
1 |
| -/** |
2 |
| - * This file is part of Skript. |
3 |
| - * |
4 |
| - * Skript is free software: you can redistribute it and/or modify |
5 |
| - * it under the terms of the GNU General Public License as published by |
6 |
| - * the Free Software Foundation, either version 3 of the License, or |
7 |
| - * (at your option) any later version. |
8 |
| - * |
9 |
| - * Skript is distributed in the hope that it will be useful, |
10 |
| - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
| - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
| - * GNU General Public License for more details. |
13 |
| - * |
14 |
| - * You should have received a copy of the GNU General Public License |
15 |
| - * along with Skript. If not, see <http://www.gnu.org/licenses/>. |
16 |
| - * |
17 |
| - * Copyright Peter Güttinger, SkriptLang team and contributors |
18 |
| - */ |
19 | 1 | package ch.njol.skript.effects;
|
20 | 2 |
|
21 |
| -import ch.njol.skript.aliases.ItemData; |
22 |
| -import org.bukkit.Material; |
23 |
| -import org.bukkit.Tag; |
24 |
| -import org.bukkit.entity.AbstractHorse; |
25 |
| -import org.bukkit.entity.ChestedHorse; |
26 |
| -import org.bukkit.entity.LivingEntity; |
27 |
| -import org.bukkit.entity.Llama; |
28 |
| -import org.bukkit.entity.Pig; |
29 |
| -import org.bukkit.entity.Player; |
30 |
| -import org.bukkit.entity.Steerable; |
31 |
| -import org.bukkit.event.Event; |
32 |
| -import org.bukkit.inventory.EntityEquipment; |
33 |
| -import org.bukkit.inventory.Inventory; |
34 |
| -import org.bukkit.inventory.ItemStack; |
35 |
| -import org.bukkit.inventory.LlamaInventory; |
36 |
| -import org.jetbrains.annotations.Nullable; |
37 |
| - |
38 | 3 | import ch.njol.skript.Skript;
|
39 |
| -import ch.njol.skript.aliases.Aliases; |
| 4 | +import ch.njol.skript.aliases.ItemData; |
40 | 5 | import ch.njol.skript.aliases.ItemType;
|
41 | 6 | import ch.njol.skript.bukkitutil.PlayerUtils;
|
42 | 7 | import ch.njol.skript.doc.Description;
|
|
47 | 12 | import ch.njol.skript.lang.Expression;
|
48 | 13 | import ch.njol.skript.lang.SkriptParser.ParseResult;
|
49 | 14 | import ch.njol.util.Kleenean;
|
| 15 | +import org.bukkit.Material; |
| 16 | +import org.bukkit.Tag; |
| 17 | +import org.bukkit.entity.*; |
| 18 | +import org.bukkit.event.Event; |
| 19 | +import org.bukkit.inventory.EntityEquipment; |
| 20 | +import org.bukkit.inventory.Inventory; |
| 21 | +import org.bukkit.inventory.ItemStack; |
| 22 | +import org.bukkit.inventory.LlamaInventory; |
| 23 | +import org.jetbrains.annotations.Nullable; |
50 | 24 |
|
51 | 25 | @Name("Equip")
|
52 |
| -@Description("Equips or unequips an entity with some given armor. This will replace any armor that the entity is wearing.") |
| 26 | +@Description( |
| 27 | + "Equips or unequips an entity with some given armor. " + |
| 28 | + "This will replace any armor that the entity is wearing." |
| 29 | +) |
53 | 30 | @Examples({
|
54 |
| - "equip player with diamond helmet", |
55 |
| - "equip player with all diamond armor", |
56 |
| - "unequip diamond chestplate from player", |
57 |
| - "unequip all armor from player", |
58 |
| - "unequip player's armor" |
| 31 | + "equip player with diamond helmet", |
| 32 | + "equip player with all diamond armor", |
| 33 | + "unequip diamond chestplate from player", |
| 34 | + "unequip all armor from player", |
| 35 | + "unequip player's armor" |
59 | 36 | })
|
60 | 37 | @Since("1.0, 2.7 (multiple entities, unequip)")
|
61 | 38 | public class EffEquip extends Effect {
|
62 | 39 |
|
| 40 | + private static final ItemType HORSE_ARMOR; |
| 41 | + |
63 | 42 | static {
|
| 43 | + if (Skript.isRunningMinecraft(1, 14)) { |
| 44 | + HORSE_ARMOR = new ItemType(Material.IRON_HORSE_ARMOR, Material.GOLDEN_HORSE_ARMOR, |
| 45 | + Material.DIAMOND_HORSE_ARMOR, Material.LEATHER_HORSE_ARMOR); |
| 46 | + } else { |
| 47 | + HORSE_ARMOR = new ItemType(Material.IRON_HORSE_ARMOR, Material.GOLDEN_HORSE_ARMOR, |
| 48 | + Material.DIAMOND_HORSE_ARMOR); |
| 49 | + } |
| 50 | + |
64 | 51 | Skript.registerEffect(EffEquip.class,
|
65 | 52 | "equip [%livingentities%] with %itemtypes%",
|
66 | 53 | "make %livingentities% wear %itemtypes%",
|
67 | 54 | "unequip %itemtypes% [from %livingentities%]",
|
68 |
| - "unequip %livingentities%'[s] (armor|equipment)" |
69 |
| - ); |
| 55 | + "unequip %livingentities%'[s] (armo[u]r|equipment)"); |
70 | 56 | }
|
71 | 57 |
|
72 | 58 | @SuppressWarnings("NotNullFieldNotInitialized")
|
@@ -99,7 +85,6 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
|
99 | 85 | private static ItemType LEGGINGS;
|
100 | 86 | private static ItemType BOOTS;
|
101 | 87 | private static ItemType CARPET;
|
102 |
| - private static final ItemType HORSE_ARMOR = new ItemType(Material.IRON_HORSE_ARMOR, Material.GOLDEN_HORSE_ARMOR, Material.DIAMOND_HORSE_ARMOR); |
103 | 88 | private static final ItemType SADDLE = new ItemType(Material.SADDLE);
|
104 | 89 | private static final ItemType CHEST = new ItemType(Material.CHEST);
|
105 | 90 |
|
|
0 commit comments