Skip to content
This repository was archived by the owner on Jun 3, 2023. It is now read-only.

Commit 4c57591

Browse files
Fixed NoSuchtMethodException on newer spigot versions
1 parent 70f5b58 commit 4c57591

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/kotlin/de/studiocode/miniatureblocks/util/ReflectionRegistry.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import org.bukkit.Bukkit
1414
import org.bukkit.Location
1515
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason
1616
import org.bukkit.inventory.ItemStack
17-
import org.bukkit.util.Consumer
1817

1918
@Suppress("MemberVisibilityCanBePrivate", "UNCHECKED_CAST")
2019
object ReflectionRegistry {
@@ -47,7 +46,7 @@ object ReflectionRegistry {
4746
val CB_CRAFT_SERVER_SYNC_COMMANDS_METHOD = getMethod(CB_CRAFT_SERVER_CLASS, true, "syncCommands")
4847
val CB_CRAFT_ENTITY_GET_HANDLE_METHOD = getMethod(CB_CRAFT_ENTITY_CLASS, false, "getHandle")
4948
val CB_CRAFT_WORLD_CREATE_ENTITY_METHOD = getMethod(CB_CRAFT_WORLD_CLASS, false, "createEntity", Location::class.java, Class::class.java)
50-
val CB_CRAFT_WORLD_ADD_ENTITY_METHOD = getMethod(CB_CRAFT_WORLD_CLASS, false, "addEntity", NMS_ENTITY_CLASS, SpawnReason::class.java, Consumer::class.java)
49+
val CB_CRAFT_WORLD_ADD_ENTITY_METHOD = getMethod(CB_CRAFT_WORLD_CLASS, false, "addEntity", NMS_ENTITY_CLASS, SpawnReason::class.java)
5150
val CB_CRAFT_ITEM_STACK_AS_NMS_COPY_METHOD = getMethod(CB_CRAFT_ITEM_STACK_CLASS, false, "asNMSCopy", ItemStack::class.java)
5251

5352
// NMS fields

src/main/kotlin/de/studiocode/miniatureblocks/util/ReflectionUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ object ReflectionUtils {
131131
}
132132

133133
fun addNMSEntityToWorld(world: World, entity: Any): Entity {
134-
return CB_CRAFT_WORLD_ADD_ENTITY_METHOD.invoke(world, entity, CreatureSpawnEvent.SpawnReason.CUSTOM, null) as Entity
134+
return CB_CRAFT_WORLD_ADD_ENTITY_METHOD.invoke(world, entity, CreatureSpawnEvent.SpawnReason.CUSTOM) as Entity
135135
}
136136

137137
fun createNMSItemStackCopy(itemStack: ItemStack): Any {

0 commit comments

Comments
 (0)