Skip to content

Commit

Permalink
disable gravity for combat npcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gutin1 committed Apr 16, 2024
1 parent 489d053 commit 1cb1c43
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import net.citizensnpcs.api.event.NPCDamageEvent
import net.citizensnpcs.api.event.NPCDeathEvent
import net.citizensnpcs.api.npc.NPC
import net.citizensnpcs.api.npc.NPCRegistry
import net.citizensnpcs.trait.Gravity
import net.horizonsend.ion.common.database.schema.misc.SLPlayer
import net.horizonsend.ion.common.database.slPlayerId
import net.horizonsend.ion.common.extensions.alert
Expand Down Expand Up @@ -91,8 +92,13 @@ object CombatNPCs : IonServerComponent(true) {

npc.entity.customName(text("${player.name} [NPC]"))
npc.isProtected = false

npc.spawn(player.location)

npc.getOrAddTrait(Gravity::class.java).apply {
setEnabled(false)
}

inventories[npc.id] = inventoryCopy
npcToPlayer[playerId] = npc to location

Expand Down

0 comments on commit 1cb1c43

Please sign in to comment.