#EntityTypegetType() uses NMS interally right? Because i need to stop player killing mobs and i need
1 messages · Page 1 of 1 (latest)
Because i need to stop players killing mobs on 1.17 and 1.19 with the same plugin
under the hood everything is essentially NMS
Spigot just exposes it in a user friendly way
Yeah
aka spigot-api
Burch doesnt it apply?
Because im abit annoyed with that part
Maybe i do a abstract class Entities (adding the common ones there) and then creating a 1.17 and 1.19 impl
What do you think?
And also thanks for helping man
there's no point
one server calls 1 version
the other server calls the other version
EntityType is a spigot wrapper, it doesn't return the nms type
so you're fine
spigot isn't that fragile
all events return spigot types
only reason you should worry about that is if you're modifying pathfinders or nms mob behavior
Okay, so i just do a Set<String> with all mob entities on last version
You can do those MinecraftVersion utilities and then like
because ilusion
if(MinecraftVersion.isNewerThan(1.18)
register118mobs
if(...)
I just need to stop damage to mobs on 1.16 and 1.19
yeah spigot is forwards compatible
Okay but what about mobs so?
hmm
maybe a registerMobType that just adds an enum value to an enumset
with a trycatch
EntityType.valueOf(String)
catch illegal argument exception
return null if so
returns a EntityType of the current running spigot server
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EntityType.html#valueOf(java.lang.String)
declaration: package: org.bukkit.entity, enum: EntityType
sadly i wish EntityType had getEntity() like how Material has getMaterial
Set<String> entities = new HashSet<>();
if (entities.contains(event.getEntity().getType().name()))
event.setCancelled(true);```
^
I cannot do that
you can
Because on 1.16 and 1.19 mobs are diff
ah uh
That why haha
The one I think would better would be checking entity name and comparing over a Set
Yes it does
What y2k?