Update axapi

This commit is contained in:
TomTom 2024-05-04 18:08:17 +02:00
parent f90a28e8b0
commit 36845a1430
3 changed files with 26 additions and 18 deletions

View File

@ -57,12 +57,14 @@ abstract class MinionType(private val name: String, private val defaults: InputS
Placeholder.unparsed("level", level.toString()),
Placeholder.unparsed("actions", actions.toString())
)
builder.storePersistentData(Keys.MINION_TYPE, PersistentDataType.STRING, name)
builder.storePersistentData(Keys.LEVEL, PersistentDataType.INTEGER, level)
builder.storePersistentData(Keys.STATISTICS, PersistentDataType.LONG, actions)
builder.storePersistentData(Keys.CHARGE, PersistentDataType.LONG, charge)
return builder.clonedGet()
val item = builder.clonedGet()
val meta = item.itemMeta!!
meta.persistentDataContainer.set(Keys.MINION_TYPE, PersistentDataType.STRING, name)
meta.persistentDataContainer.set(Keys.LEVEL, PersistentDataType.INTEGER, level)
meta.persistentDataContainer.set(Keys.STATISTICS, PersistentDataType.LONG, actions)
meta.persistentDataContainer.set(Keys.CHARGE, PersistentDataType.LONG, charge)
item.itemMeta = meta
return item
}
fun getConfig(): Config {

View File

@ -135,7 +135,7 @@ allprojects {
compileOnly 'com.github.LoneDev6:api-itemsadder:3.6.1'
compileOnly 'com.palmergames.bukkit.towny:towny:0.100.1.0'
implementation platform('com.intellectualsites.bom:bom-newest:1.35')
implementation("com.artillexstudios.axapi:axapi:1.4.134")
implementation("com.artillexstudios.axapi:axapi:1.4.190:all")
implementation("com.zaxxer:HikariCP:5.1.0")
implementation("org.bstats:bstats-bukkit:3.0.2")
compileOnly 'org.black_ixx:playerpoints:3.2.6'

View File

@ -5,7 +5,7 @@ import com.artillexstudios.axapi.entity.impl.PacketArmorStand
import com.artillexstudios.axapi.entity.impl.PacketEntity
import com.artillexstudios.axapi.events.PacketEntityInteractEvent
import com.artillexstudios.axapi.hologram.Hologram
import com.artillexstudios.axapi.hologram.HologramFactory
import com.artillexstudios.axapi.hologram.HologramLine
import com.artillexstudios.axapi.scheduler.Scheduler
import com.artillexstudios.axapi.serializers.Serializers
import com.artillexstudios.axapi.utils.EquipmentSlot
@ -155,8 +155,8 @@ class Minion(
)
if (Config.DEBUG()) {
debugHologram = HologramFactory.get().spawnHologram(location.clone().add(0.0, 2.0, 0.0), "$locationID")
debugHologram?.addLine(StringUtils.format("ticking: $ticking"))
debugHologram = Hologram(location.clone().add(0.0, 2.0, 0.0), "$locationID")
debugHologram?.addLine("ticking: $ticking", HologramLine.Type.TEXT)
}
setDirection(direction, false)
@ -198,7 +198,7 @@ class Minion(
}
if (Config.DEBUG() && debugHologram != null) {
debugHologram?.setLine(0, StringUtils.format("Ticking: $ticking"))
debugHologram?.setLine(0, "Ticking: $ticking")
}
if (Config.CHARGE_ENABLED() && getCharge() < System.currentTimeMillis()) {
@ -302,17 +302,21 @@ class Minion(
actions,
multiplier,
nextMultiplier
).storePersistentData(
Keys.GUI, PersistentDataType.STRING, it
).get()
val meta = item.itemMeta!!
meta.persistentDataContainer.set(Keys.GUI, PersistentDataType.STRING, it)
item.itemMeta = meta
} else if (it.equals("item")) {
item = tool?.clone() ?: ItemStack(Material.AIR)
} else if (it.equals("charge")) {
if (Config.CHARGE_ENABLED()) {
val charge = Placeholder.parsed("charge", TimeUtils.format(charge - System.currentTimeMillis()))
item = ItemBuilder(AxMinionsAPI.INSTANCE.getConfig().getConfig().getSection("gui.items.$it"), charge).storePersistentData(
Keys.GUI, PersistentDataType.STRING, it
).get()
item = ItemBuilder(AxMinionsAPI.INSTANCE.getConfig().getConfig().getSection("gui.items.$it"), charge).get()
val meta = item.itemMeta!!
meta.persistentDataContainer.set(Keys.GUI, PersistentDataType.STRING, it)
item.itemMeta = meta
} else {
item = null
}
@ -328,9 +332,11 @@ class Minion(
AxMinionsAPI.INSTANCE.getConfig().getConfig().getSection("gui.items.$it"),
rotation,
linked
).storePersistentData(
Keys.GUI, PersistentDataType.STRING, it
).get()
val meta = item.itemMeta!!
meta.persistentDataContainer.set(Keys.GUI, PersistentDataType.STRING, it)
item.itemMeta = meta
}
if (item != null) {