|
23 | 23 |
|
24 | 24 | import java.io.NotSerializableException; |
25 | 25 | import java.io.StreamCorruptedException; |
| 26 | +import java.util.Arrays; |
26 | 27 | import java.util.List; |
27 | 28 | import java.util.Locale; |
28 | 29 | import java.util.Map.Entry; |
|
46 | 47 | import org.bukkit.entity.Player; |
47 | 48 | import org.bukkit.entity.Projectile; |
48 | 49 | import org.bukkit.event.entity.EntityDamageEvent.DamageCause; |
| 50 | +import org.bukkit.event.inventory.InventoryAction; |
49 | 51 | import org.bukkit.inventory.Inventory; |
50 | 52 | import org.bukkit.inventory.InventoryHolder; |
51 | 53 | import org.bukkit.inventory.ItemStack; |
|
68 | 70 | import ch.njol.skript.expressions.base.EventValueExpression; |
69 | 71 | import ch.njol.skript.lang.ParseContext; |
70 | 72 | import ch.njol.skript.lang.util.SimpleLiteral; |
| 73 | +import ch.njol.skript.localization.Language; |
71 | 74 | import ch.njol.skript.localization.Message; |
72 | 75 | import ch.njol.skript.registrations.Classes; |
73 | 76 | import ch.njol.skript.util.BiomeUtils; |
@@ -475,6 +478,39 @@ public String getVariableNamePattern() { |
475 | 478 | } |
476 | 479 | }).changer(DefaultChangers.inventoryChanger)); |
477 | 480 |
|
| 481 | + Classes.registerClass(new ClassInfo<InventoryAction>(InventoryAction.class, "inventory action") |
| 482 | + .user("inventory actions?") |
| 483 | + .name("Inventory Action") |
| 484 | + .description("There are multiple ways to perform clicks in inventories. Inventory actions represent them.") |
| 485 | + .user(Language.getList("inventory actions")) |
| 486 | + .examples("") |
| 487 | + .since("2.2-dev16") |
| 488 | + .defaultExpression(new EventValueExpression<InventoryAction>(InventoryAction.class)) |
| 489 | + .parser(new Parser<InventoryAction>() { |
| 490 | + |
| 491 | + @Override |
| 492 | + @Nullable |
| 493 | + public InventoryAction parse(String s, ParseContext context) { |
| 494 | + return null; // TODO Do this, while supporting language changes... How? |
| 495 | + } |
| 496 | + |
| 497 | + @Override |
| 498 | + public String toString(InventoryAction o, int flags) { |
| 499 | + return Language.get("inventory actions." + o.toString().toLowerCase()); |
| 500 | + } |
| 501 | + |
| 502 | + @Override |
| 503 | + public String toVariableNameString(InventoryAction o) { |
| 504 | + return Language.get("inventory actions." + o.toString().toLowerCase()); |
| 505 | + } |
| 506 | + |
| 507 | + @Override |
| 508 | + public String getVariableNamePattern() { |
| 509 | + return "[a-z]+"; |
| 510 | + } |
| 511 | + |
| 512 | + })); |
| 513 | + |
478 | 514 | Classes.registerClass(new ClassInfo<Player>(Player.class, "player") |
479 | 515 | .user("players?") |
480 | 516 | .name("Player") |
|
0 commit comments