@@ -170,14 +170,15 @@ private boolean setupNMSProvider() {
170
170
// Rare cases might trigger API usage before SilkSpawners
171
171
if (version == null ) {
172
172
final String packageName = Bukkit .getServer ().getClass ().getPackage ().getName ();
173
- String nmsVersion = packageName .substring (packageName .lastIndexOf ('.' ) + 1 );
173
+ final String nmsVersion = packageName .substring (packageName .lastIndexOf ('.' ) + 1 );
174
174
if (nmsVersion .equals ("craftbukkit" )) {
175
175
try {
176
- String minecraftVersion = (String ) Server .class .getDeclaredMethod ("getMinecraftVersion" ).invoke (Bukkit .getServer ());
177
- Semver semver = new Semver (minecraftVersion );
176
+ final String minecraftVersion = (String ) Server .class .getDeclaredMethod ("getMinecraftVersion" )
177
+ .invoke (Bukkit .getServer ());
178
+ final Semver semver = new Semver (minecraftVersion );
178
179
if (semver .isGreaterThanOrEqualTo ("1.20.5" )) {
179
180
@ SuppressWarnings ("deprecation" )
180
- int protocolVersion = (Integer ) UnsafeValues .class .getDeclaredMethod ("getProtocolVersion" )
181
+ final int protocolVersion = (Integer ) UnsafeValues .class .getDeclaredMethod ("getProtocolVersion" )
181
182
.invoke (Bukkit .getUnsafe ());
182
183
version = SilkSpawners .PROTOCOL_VERSION_PACKAGE_MAP .get (protocolVersion );
183
184
}
@@ -344,7 +345,7 @@ public boolean isVanillaBossBar() {
344
345
*
345
346
* @deprecated Use {@link SilkUtil#newEggItem(String, int, String)} instead.
346
347
* @param entityID which mob should be spawned
347
- * @param amount the amount of spawn eggs
348
+ * @param amount the amount of spawn eggs
348
349
* @return the ItemStack
349
350
*/
350
351
@ Deprecated
@@ -355,8 +356,8 @@ public ItemStack newEggItem(final String entityID, final int amount) {
355
356
/**
356
357
* Returns a new ItemStack of a spawn egg with the specified amount and mob.
357
358
*
358
- * @param entityID which mob should be spawned
359
- * @param amount the amount of spawn eggs
359
+ * @param entityID which mob should be spawned
360
+ * @param amount the amount of spawn eggs
360
361
* @param displayName the display name of the egg in case of unknown entities
361
362
* @return the ItemStack
362
363
*/
@@ -368,10 +369,10 @@ public ItemStack newEggItem(final String entityID, final int amount, final Strin
368
369
/**
369
370
* This method will make a new MobSpawner with a custom entityID, name and amount.
370
371
*
371
- * @param entityID the mob
372
+ * @param entityID the mob
372
373
* @param customName if the MobSpawner should be named different
373
- * @param amount the wanted amount
374
- * @param forceLore whether the lore tag should be forces
374
+ * @param amount the wanted amount
375
+ * @param forceLore whether the lore tag should be forces
375
376
* @return the ItemStack with the configured options
376
377
*/
377
378
public ItemStack newSpawnerItem (final String entityID , final String customName , final int amount , final boolean forceLore ) {
@@ -458,6 +459,11 @@ public String getStoredSpawnerItemEntityID(final ItemStack item) {
458
459
if (StringUtils .isNotBlank (entityID )) {
459
460
return entityID .replace ("minecraft:" , "" );
460
461
}
462
+ entityID = nmsProvider .getOtherPluginsNBTEntityID (item );
463
+ plugin .getLogger ().log (Level .FINE , "EntityID from item stack (other plugin tags) is {0}" , entityID );
464
+ if (StringUtils .isNotBlank (entityID )) {
465
+ return entityID .replace ("minecraft:" , "" );
466
+ }
461
467
}
462
468
if (item .hasItemMeta ()) {
463
469
final String metaEntityID = searchItemMeta (item .getItemMeta ());
@@ -533,7 +539,7 @@ public String getSpawnerEntityID(final Block block) {
533
539
/**
534
540
* Set the specified MonterSpawner to another entity ID.
535
541
*
536
- * @param block MonsterSpawner
542
+ * @param block MonsterSpawner
537
543
* @param entity the wanted entity
538
544
*/
539
545
public void setSpawnerEntityID (final Block block , final String entity ) {
@@ -567,9 +573,9 @@ public void setSpawnerEntityID(final Block block, final String entity) {
567
573
/**
568
574
* Set a spawner (if allowed) to a new mob.
569
575
*
570
- * @param block the MonsterSpawner
571
- * @param entityID the new entity ID
572
- * @param player the player
576
+ * @param block the MonsterSpawner
577
+ * @param entityID the new entity ID
578
+ * @param player the player
573
579
* @param messageDenied the message which is shown, when the player can't build here see {@link #canBuildHere(Player, Location)}
574
580
* @return whether the operation was successful or not
575
581
*/
@@ -587,8 +593,8 @@ public boolean setSpawnerType(final Block block, final String entityID, final Pl
587
593
/**
588
594
* Sets a spawner item or egg to a new ID.
589
595
*
590
- * @param item ItemStack (Egg or Spawner)
591
- * @param entityID wanted entity ID
596
+ * @param item ItemStack (Egg or Spawner)
597
+ * @param entityID wanted entity ID
592
598
* @param customName if a custom name should be used (null for none)
593
599
* @return the updated ItemStack
594
600
*/
@@ -734,7 +740,7 @@ public List<String> scanEntityMap() {
734
740
/**
735
741
* Notify a player about the spawner.
736
742
*
737
- * @param player the player
743
+ * @param player the player
738
744
* @param spawnerName the creature name
739
745
*/
740
746
@ SuppressWarnings ("deprecation" )
@@ -938,7 +944,7 @@ private void getMimic() {
938
944
/**
939
945
* Checks if a player can build here (WorldGuard).
940
946
*
941
- * @param player the player
947
+ * @param player the player
942
948
* @param location the location to check
943
949
* @return the result, true or false
944
950
*/
@@ -980,9 +986,9 @@ public boolean isLegacySpawnEggs() {
980
986
/**
981
987
* Helper methods to check if a player has any of the aliases permissions for a given mobID.
982
988
*
983
- * @param permissible - the permissible to check the permission for
989
+ * @param permissible - the permissible to check the permission for
984
990
* @param basePermission - the basis permission without the specific mob
985
- * @param entityID - the internal mob ID (not display name)
991
+ * @param entityID - the internal mob ID (not display name)
986
992
* @return the permission check result, true if the player has got the permission, false otherwise
987
993
*/
988
994
public boolean hasPermission (final Permissible permissible , final String basePermission , final String entityID ) {
0 commit comments