Skip to content

Commit 067ff12

Browse files
committed
Version 0.5.00 Update
1 parent c02848c commit 067ff12

File tree

6 files changed

+60
-5
lines changed

6 files changed

+60
-5
lines changed

api/src/main/java/com/redmagic/undefinedapi/nms/NMSPlayer.kt

+18
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,26 @@ interface NMSPlayer: NMSEntity {
138138
* Kills the entity.
139139
*/
140140
fun kill()
141+
/**
142+
* Triggers a death animation for the entity.
143+
*
144+
* This method plays the animation of the entity dying. It does not directly apply any damage or modify the entity's health.
145+
* The animation can be used to provide visual feedback to the player or create special effects.
146+
*
147+
* @receiver The entity to perform the death animation on.
148+
*/
141149
fun deathAnimation()
142150

151+
/**
152+
* Resets the pose of the entity.
153+
*
154+
* This method resets the pose of the entity to the default standing position. It can be used to reset any custom
155+
* poses or animations applied to the entity.
156+
*
157+
* Note: This method does not have any parameters or return values.
158+
*/
159+
fun resetPose()
160+
143161
/**
144162
* Triggers a damage animation for the entity.
145163
*

build.gradle.kts

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212
}
1313

1414
apply(plugin = "maven-publish")
15-
val versionVar = "0.4.51"
15+
val versionVar = "0.5.00"
1616
val groupIdVar = "com.redmagic"
1717
val artifactIdVar = "UndefinedAPI"
1818

@@ -36,6 +36,10 @@ publishing {
3636
artifactId = artifactIdVar
3737
version = versionVar
3838

39+
artifact("dev"){
40+
enabled = false
41+
}
42+
3943
from(components["java"])
4044
}
4145
}

server/src/main/java/com/redmagic/undefinedapi/Main.kt

+15-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.redmagic.undefinedapi.nms.ItemSlot
77
import com.redmagic.undefinedapi.nms.createFakePlayer
88
import com.redmagic.undefinedapi.scheduler.delay
99
import org.bukkit.Bukkit
10+
import org.bukkit.Location
1011
import org.bukkit.Material
1112
import org.bukkit.event.player.PlayerJoinEvent
1213
import org.bukkit.inventory.ItemStack
@@ -22,11 +23,19 @@ class Main: JavaPlugin() {
2223
event<PlayerJoinEvent> {
2324

2425
val npc = api.createFakePlayer("TheRedMagic", "TheRedMagic")!!
25-
npc.viewers.add(player)
26-
npc.spawn(player.location)
26+
npc.viewers.remove(player)
27+
28+
val newLoc = Location(Bukkit.getWorld("world"), 10.0, 10.0, 10.0)
29+
30+
npc.moveOrTeleport(newLoc)
31+
32+
npc.name = "NewName"
33+
34+
npc.resetPose()
35+
2736

2837
delay(20) {
29-
npc.location = player.location.clone().add(0.0,5.0,0.0)
38+
npc.teleport(newLoc)
3039
delay(20) {
3140
npc.name = "Jeff"
3241
npc.isCrouching = true
@@ -40,7 +49,9 @@ class Main: JavaPlugin() {
4049

4150
npc.setItem(ItemSlot.MAINHAND, ItemStack(Material.SHIELD))
4251

43-
npc.useMainHand()
52+
npc.moveMainHand()
53+
54+
npc.moveOffHand()
4455
delay(20) {
4556
npc.kill()
4657
}

v1_20_4/src/main/java/com/redmagic/undefinedapi/npc/NMSPlayer1_20_4.kt

+7
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,13 @@ class NMSPlayer1_20_4(name: String, skin: String): NMSPlayer {
630630

631631
}
632632

633+
/**
634+
* Resets the pose of the player.
635+
*/
636+
override fun resetPose() {
637+
isCrouching = false
638+
}
639+
633640
/**
634641
* Returns whether the player is alive.
635642
*

v1_20_5/src/main/java/com/redmagic/undefinedapi/npc/NMSPlayer1_20_5.kt

+6
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ class NMSPlayer1_20_5(name: String, skin: String): NMSPlayer {
628628
}
629629

630630
}
631+
/**
632+
* Resets the pose of the player.
633+
*/
634+
override fun resetPose() {
635+
isCrouching = false
636+
}
631637

632638
/**
633639
* Returns whether the player is alive.

v1_20_6/src/main/java/com/redmagic/undefinedapi/npc/NMSPlayer1_20_6.kt

+9
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,13 @@ class NMSPlayer1_20_6(name: String, skin: String): NMSPlayer {
629629

630630
}
631631

632+
/**
633+
* Resets the pose of the player.
634+
*/
635+
override fun resetPose() {
636+
isCrouching = false
637+
}
638+
632639
/**
633640
* Returns whether the player is alive.
634641
*
@@ -645,6 +652,8 @@ class NMSPlayer1_20_6(name: String, skin: String): NMSPlayer {
645652

646653
val nmsPose = net.minecraft.world.entity.Pose.valueOf(pose.name)
647654

655+
if (serverPlayer.pose == nmsPose) return
656+
648657
serverPlayer.pose = nmsPose
649658

650659
val dataList: MutableList<SynchedEntityData.DataValue<*>> = mutableListOf(

0 commit comments

Comments
 (0)