|
12 | 12 | import ch.njol.skript.lang.util.SimpleLiteral; |
13 | 13 | import ch.njol.skript.registrations.Classes; |
14 | 14 | import ch.njol.skript.util.BlockUtils; |
15 | | -import ch.njol.skript.util.PotionEffectUtils; |
16 | 15 | import ch.njol.yggdrasil.Fields; |
17 | 16 | import io.papermc.paper.world.MoonPhase; |
18 | 17 | import org.bukkit.*; |
|
29 | 28 | import org.bukkit.entity.*; |
30 | 29 | import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; |
31 | 30 | import org.bukkit.event.entity.EntityDamageEvent.DamageCause; |
32 | | -import org.bukkit.event.entity.EntityPotionEffectEvent; |
33 | 31 | import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; |
34 | 32 | import org.bukkit.event.entity.EntityTransformEvent.TransformReason; |
35 | 33 | import org.bukkit.event.entity.EntityUnleashEvent; |
|
47 | 45 | import org.bukkit.inventory.InventoryHolder; |
48 | 46 | import org.bukkit.inventory.ItemFlag; |
49 | 47 | import org.bukkit.metadata.Metadatable; |
50 | | -import org.bukkit.potion.PotionEffect; |
51 | | -import org.bukkit.potion.PotionEffectType; |
52 | 48 | import org.bukkit.util.CachedServerIcon; |
53 | 49 | import org.bukkit.util.Vector; |
54 | 50 | import org.jetbrains.annotations.Nullable; |
@@ -542,86 +538,6 @@ public String toVariableNameString(InventoryHolder holder) { |
542 | 538 | .since("1.4.4") |
543 | 539 | .after("damagecause")); |
544 | 540 |
|
545 | | - Classes.registerClass(new ClassInfo<>(PotionEffect.class, "potioneffect") |
546 | | - .user("potion ?effects?") |
547 | | - .name("Potion Effect") |
548 | | - .description("A potion effect, including the potion effect type, tier and duration.") |
549 | | - .usage("speed of tier 1 for 10 seconds") |
550 | | - .since("2.5.2") |
551 | | - .parser(new Parser<PotionEffect>() { |
552 | | - |
553 | | - @Override |
554 | | - public boolean canParse(ParseContext context) { |
555 | | - return false; |
556 | | - } |
557 | | - |
558 | | - @Override |
559 | | - public String toString(PotionEffect potionEffect, int flags) { |
560 | | - return PotionEffectUtils.toString(potionEffect); |
561 | | - } |
562 | | - |
563 | | - @Override |
564 | | - public String toVariableNameString(PotionEffect o) { |
565 | | - return "potion_effect:" + o.getType().getName(); |
566 | | - } |
567 | | - |
568 | | - }) |
569 | | - .serializer(new Serializer<PotionEffect>() { |
570 | | - @Override |
571 | | - public Fields serialize(PotionEffect o) { |
572 | | - Fields fields = new Fields(); |
573 | | - fields.putObject("type", o.getType().getName()); |
574 | | - fields.putPrimitive("amplifier", o.getAmplifier()); |
575 | | - fields.putPrimitive("duration", o.getDuration()); |
576 | | - fields.putPrimitive("particles", o.hasParticles()); |
577 | | - fields.putPrimitive("ambient", o.isAmbient()); |
578 | | - return fields; |
579 | | - } |
580 | | - |
581 | | - @Override |
582 | | - public void deserialize(PotionEffect o, Fields f) { |
583 | | - assert false; |
584 | | - } |
585 | | - |
586 | | - @Override |
587 | | - protected PotionEffect deserialize(Fields fields) throws StreamCorruptedException { |
588 | | - String typeName = fields.getObject("type", String.class); |
589 | | - assert typeName != null; |
590 | | - PotionEffectType type = PotionEffectType.getByName(typeName); |
591 | | - if (type == null) |
592 | | - throw new StreamCorruptedException("Invalid PotionEffectType " + typeName); |
593 | | - int amplifier = fields.getPrimitive("amplifier", int.class); |
594 | | - int duration = fields.getPrimitive("duration", int.class); |
595 | | - boolean particles = fields.getPrimitive("particles", boolean.class); |
596 | | - boolean ambient = fields.getPrimitive("ambient", boolean.class); |
597 | | - return new PotionEffect(type, duration, amplifier, ambient, particles); |
598 | | - } |
599 | | - |
600 | | - @Override |
601 | | - public boolean mustSyncDeserialization() { |
602 | | - return false; |
603 | | - } |
604 | | - |
605 | | - @Override |
606 | | - protected boolean canBeInstantiated() { |
607 | | - return false; |
608 | | - } |
609 | | - })); |
610 | | - |
611 | | - Registry<PotionEffectType> petRegistry = BukkitUtils.getPotionEffectTypeRegistry(); |
612 | | - if (petRegistry != null) { |
613 | | - Classes.registerClass(new RegistryClassInfo<>(PotionEffectType.class, petRegistry, "potioneffecttype", "potion effect types", false) |
614 | | - .user("potion ?effect ?types?") |
615 | | - .name("Potion Effect Type") |
616 | | - .description("A potion effect type, e.g. 'strength' or 'swiftness'.") |
617 | | - .examples("apply swiftness 5 to the player", |
618 | | - "apply potion of speed 2 to the player for 60 seconds", |
619 | | - "remove invisibility from the victim") |
620 | | - .since("")); |
621 | | - } else { |
622 | | - Classes.registerClass(PotionEffectUtils.getLegacyClassInfo()); |
623 | | - } |
624 | | - |
625 | 541 | // REMIND make my own damage cause class (that e.g. stores the attacker entity, the projectile, or the attacking block) |
626 | 542 | Classes.registerClass(new EnumClassInfo<>(DamageCause.class, "damagecause", "damage causes", new ExprDamageCause()) |
627 | 543 | .user("damage ?causes?") |
@@ -1000,12 +916,6 @@ public String toVariableNameString(EnchantmentOffer eo) { |
1000 | 916 | .description("Represents flags that may be applied to hide certain attributes of an item.") |
1001 | 917 | .since("2.10")); |
1002 | 918 |
|
1003 | | - Classes.registerClass(new EnumClassInfo<>(EntityPotionEffectEvent.Cause.class, "entitypotioncause", "entity potion causes") |
1004 | | - .user("(entity )?potion ?effect ?cause") |
1005 | | - .name("Entity Potion Cause") |
1006 | | - .description("Represents the cause of the action of a potion effect on an entity, e.g. arrow, command") |
1007 | | - .since("2.10")); |
1008 | | - |
1009 | 919 | Classes.registerClass(new EnumClassInfo<>(ChangeReason.class, "experiencecooldownchangereason", "experience cooldown change reasons") |
1010 | 920 | .user("(experience|[e]xp) cooldown change (reason|cause)s?") |
1011 | 921 | .name("Experience Cooldown Change Reason") |
|
0 commit comments