SpawnerProvider is giving null when using getEntityType
Max604 opened this issue ยท 3 comments
Information
Full output of /ess version
: [18:27:37 INFO]: Server version: 1.12.2-R0.1-SNAPSHOT git-Spigot-7754231-362ed32 (MC: 1.12.2)
[18:27:37 INFO]: EssentialsX version: 2.17.1.0
[18:27:37 INFO]: PermissionsEx version: 1.23.4
[18:27:37 INFO]: Vault version: 1.6.6-b${env.TRAVIS_BUILD_NUMBER}
[18:27:37 INFO]: EssentialsXChat version: TeamCity
[18:27:37 INFO]: EssentialsXSpawn version: TeamCity
[18:27:37 INFO]: Version mismatch! Please update all Essentials jars to the same version.
[18:27:37 INFO]: You are running unsupported plugins!
Server log: not needed
EssentialsX config not needed
Help request
Problem
When trying the line on a non-null itemstack which is a mob spawner, i get null. this.essentials.getSpawnerProvider().getEntityType(clicked). However if I use the code from within BlockMetaSpawnerProvider it works fine:
public EntityType getEntityType(ItemStack is) {
BlockStateMeta bsm = (BlockStateMeta)is.getItemMeta();
CreatureSpawner bs = (CreatureSpawner)bsm.getBlockState();
return bs.getSpawnedType();
}
What I have tried
See above. I know that my SpawnerProvider variable is from essentials and non-null
Screenshots
None
This is not part of the EssentialsX API. Use at your own risk. Most likely it is a problem in your code. Take the time to debug it yourself instead of asking others to do it for you!
This is not part of the EssentialsX API. Use at your own risk. Most likely it is a problem in your code. Take the time to debug it yourself instead of asking others to do it for you!
This is part of EssentialsX? But using getEntityType from the spawner provider of EssentialsX gives null when it should not? Using a excerpt of your code from the following link does work however. https://github.com/EssentialsX/Essentials/blob/849efa9756495a34260d57ff1d81df1283e5f5e7/nms/UpdatedMetaProvider/src/net/ess3/nms/updatedmeta/BlockMetaSpawnerProvider.java
I'm not sure where you see it stating that it cannot return null. As far as I'm concerned, it's not a bug within Essentials. You should check for nulls in your code.
Essentials is open source. You may use any part of the code that you like. Please bear in mind the distinction between API and implementation details. The API is designed to be used by developers, implementation details are not (although nothing is stopping you from using them).
With that in mind, be aware that the implementation works properly within Essentials. The fact that it does not work in your plugin is not a bug in Essentials. Therefore, this issue is not valid. If you wish to improve the implementation, you can create a pull request. This requires effort on your behalf, including finding the reason why it does not work in your plugin.