SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.07k stars 369 forks source link

Phantom is not detected as a monster! #4574

Open LowScarlet opened 2 years ago

LowScarlet commented 2 years ago

Skript/Server Version

[19:33:26 INFO]: [Skript] Server Version: git-Paper-177 (MC: 1.18.1)
[19:33:26 INFO]: [Skript] Skript Version: 2.6.1-nightly-a0042ef
[19:33:26 INFO]: [Skript] Installed Skript Addons:
[19:33:26 INFO]: [Skript]  - skript-gui v1.3-beta1-nightly-f26225a (https://github.com/APickledWalrus/skript-gui)
[19:33:26 INFO]: [Skript]  - Skellett v2.0.2 (https://forums.skunity.com/resources/skellett.24/)
[19:33:26 INFO]: [Skript]  - DiSky v3.7.0 (https://disky.itsthesky.info/)
[19:33:26 INFO]: [Skript]  - skript-yaml v1.4
[19:33:26 INFO]: [Skript]  - skript-reflect v2.2.3 (https://github.com/TPGamesNL/skript-reflect)
[19:33:26 INFO]: [Skript]  - skUtilities v0.9.2 (https://tim740.github.io/)
[19:33:26 INFO]: [Skript]  - skRayFall v1.9.26 (https://sk.rayfall.net/)
[19:33:26 INFO]: [Skript]  - SkQuery v4.1.5
[19:33:26 INFO]: [Skript]  - SkBee v1.14.0 (https://github.com/ShaneBeee/SkBee)
[19:33:26 INFO]: [Skript]  - skript-holo v1.0.2 (https://github.com/Blueyescat/skript-holo)
[19:33:26 INFO]: [Skript]  - SkEmail v1.7
[19:33:26 INFO]: [Skript] Installed dependencies: 
[19:33:26 INFO]: [Skript]  - Vault v1.7.3-b131
[19:33:26 INFO]: [Skript]  - WorldGuard v7.0.6+1cff55f

Bug Description

Does phantom not fall into the category of monsters?

{_mob} is a monster

Expected Behavior

I thought Phantom was a monster?

Steps to Reproduce

{_mob} is a monster

Errors or Screenshots

Replace this text with your paste link or errors/screenshots/videos.

Other

No response

Agreement

TheBentoBox commented 2 years ago

The Phantom class doesn't extend the Monster class, so this isn't exactly intuitive but it's not wrong.

ham1255 commented 2 years ago

some explanation at https://www.spigotmc.org/threads/phantom-does-not-extend-monster.424430/#post-3728358

TPGamesNL commented 2 years ago

Does it do the same for ghasts?

AyhamAl-Ali commented 2 years ago

Same for Ghast, it inherits Flying > Mob image

AyhamAl-Ali commented 2 years ago

Closing as not a Skript issue

TPGamesNL commented 2 years ago

@AyhamAl-Ali EntityData#match can be overridden for monster to return true on phantom and ghast. The link mentioned above explains that the reason these aren't a Monster in Bukkit is likely because of language/design limitations, not because players don't see them as monsters, so I think we should let Skript see these as monsters

AyhamAl-Ali commented 2 years ago

If this case would be supported by Skript then sure, I will reopen this

ham1255 commented 2 years ago

this can be easily implemented as making Constant list with Mob types as flying monsters

private static final List<EntityType> FLYING_MONSTERS = Arrays.asList(
            EntityType.GHAST, EntityType.PHANTOM
    );

public static boolean isFlyingMonster(EntityType entityType) {
        return FLYING_MONSTERS.contains(entityType);
    } 
bluelhf commented 2 years ago

I think this suggestion would be better suited for the Bukkit API itself — Java's single inheritance limits Bukkit programmatically, but there could still be a way to check if a mob is a monster that is not limited by single inheritance, like a constant list as @ham1255 suggested.

ham1255 commented 2 years ago

This isn't bukkit limitation idk it might be too

Its in nms generally Since phantoms extends FlyingEntity Not MonsterEntity

You could see link i posted from before above it has really good explanation about this

It also has fix but it needs nms which is not recommended in my opinion

ham1255 commented 2 years ago

okay i found something that might be not related but Slimes are not monsters either? so it might be not only flying hostile mobs are effected here.

Moderocky commented 2 years ago

okay i found something that might be not related but Slimes are not monsters either? so it might be not only flying hostile mobs are effected here.

I believe originally slimes were able to spawn in peaceful mode, and the small size ones are not hostile to the player, so this may be why they were not counted as monsters.

TPGamesNL commented 2 years ago

I think it'd be a good idea to follow this definition: image

hostile mobs being these: image

ham1255 commented 2 years ago

I think it'd be a good idea to follow this definition:

image

hostile mobs being these:

image

Hostile mobs list are missing some mobs and also jockies are single mobs or 2 mobs (zombie riding chicken)?