diff --git a/api/src/main/kotlin/com/artillexstudios/axminions/api/config/Messages.kt b/api/src/main/kotlin/com/artillexstudios/axminions/api/config/Messages.kt index 38f520a..9963d81 100644 --- a/api/src/main/kotlin/com/artillexstudios/axminions/api/config/Messages.kt +++ b/api/src/main/kotlin/com/artillexstudios/axminions/api/config/Messages.kt @@ -27,13 +27,13 @@ class Messages(file: File, stream: InputStream) { @JvmStatic fun CONTAINER_FULL_WARNING() = AxMinionsAPI.INSTANCE.getMessages().get("warnings.container-full") @JvmStatic - fun TIME_DAY() = AxMinionsAPI.INSTANCE.getMessages().get("time.day") + fun TIME_DAY() = AxMinionsAPI.INSTANCE.getMessages().get("time.day") @JvmStatic - fun TIME_HOUR() = AxMinionsAPI.INSTANCE.getMessages().get("time.hour") + fun TIME_HOUR() = AxMinionsAPI.INSTANCE.getMessages().get("time.hour") @JvmStatic - fun TIME_MINUTE() = AxMinionsAPI.INSTANCE.getMessages().get("time.minute") + fun TIME_MINUTE() = AxMinionsAPI.INSTANCE.getMessages().get("time.minute") @JvmStatic - fun TIME_SECOND() = AxMinionsAPI.INSTANCE.getMessages().get("time.second") + fun TIME_SECOND() = AxMinionsAPI.INSTANCE.getMessages().get("time.second") @JvmStatic fun NO_CHARGE_WARNING() = AxMinionsAPI.INSTANCE.getMessages().get("warnings.no-charge") @JvmStatic diff --git a/api/src/main/kotlin/com/artillexstudios/axminions/api/minions/miniontype/MinionType.kt b/api/src/main/kotlin/com/artillexstudios/axminions/api/minions/miniontype/MinionType.kt index 85a905d..5272f14 100644 --- a/api/src/main/kotlin/com/artillexstudios/axminions/api/minions/miniontype/MinionType.kt +++ b/api/src/main/kotlin/com/artillexstudios/axminions/api/minions/miniontype/MinionType.kt @@ -51,7 +51,7 @@ abstract class MinionType(private val name: String, private val defaults: InputS run(minion) } - fun getItem(level: Int = 1, actions: Long = 0): ItemStack { + fun getItem(level: Int = 1, actions: Long = 0, charge: Long = 0): ItemStack { val builder = ItemBuilder( config.getSection("item"), Placeholder.unparsed("level", level.toString()), @@ -60,6 +60,7 @@ abstract class MinionType(private val name: String, private val defaults: InputS 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() } diff --git a/api/src/main/kotlin/com/artillexstudios/axminions/api/utils/Keys.kt b/api/src/main/kotlin/com/artillexstudios/axminions/api/utils/Keys.kt index fde5b7e..5945ba3 100644 --- a/api/src/main/kotlin/com/artillexstudios/axminions/api/utils/Keys.kt +++ b/api/src/main/kotlin/com/artillexstudios/axminions/api/utils/Keys.kt @@ -14,4 +14,6 @@ object Keys { val STATISTICS = NamespacedKey(AxMinionsAPI.INSTANCE.getAxMinionsInstance(), "statistics") @JvmField val PLACED = NamespacedKey(AxMinionsAPI.INSTANCE.getAxMinionsInstance(), "placed") + @JvmField + val CHARGE = NamespacedKey(AxMinionsAPI.INSTANCE.getAxMinionsInstance(), "charge") } \ No newline at end of file diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/api/AxMinionsAPIImpl.kt b/common/src/main/kotlin/com/artillexstudios/axminions/api/AxMinionsAPIImpl.kt index a93702a..07464eb 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/api/AxMinionsAPIImpl.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/api/AxMinionsAPIImpl.kt @@ -7,10 +7,12 @@ import com.artillexstudios.axminions.api.config.Messages import com.artillexstudios.axminions.api.data.DataHandler import com.artillexstudios.axminions.api.integrations.Integrations import com.artillexstudios.axminions.api.minions.Minion +import com.artillexstudios.axminions.api.minions.miniontype.MinionType import com.artillexstudios.axminions.minions.MinionTicker import com.artillexstudios.axminions.minions.Minions import org.bukkit.entity.Player import java.io.File +import java.util.Locale class AxMinionsAPIImpl(private val plugin: AxMinionsPlugin) : AxMinionsAPI { diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt b/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt index 3edd95f..1eb9b49 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt @@ -45,6 +45,7 @@ class MinionPlaceListener : Listener { val level = meta.persistentDataContainer.get(Keys.LEVEL, PersistentDataType.INTEGER) ?: 0 val stats = meta.persistentDataContainer.get(Keys.STATISTICS, PersistentDataType.LONG) ?: 0 + val charge = meta.persistentDataContainer.get(Keys.CHARGE, PersistentDataType.LONG) ?: 0 if (Config.PLACE_PERMISSION() && !event.player.hasPermission("axminions.place.${minionType.getName()}")) { event.player.sendMessage(StringUtils.formatToString(Messages.PREFIX() + Messages.PLACE_MISSING_PERMISSION())) @@ -93,7 +94,7 @@ class MinionPlaceListener : Listener { 0.0, locationId, 0, - 0 + charge ) Minions.startTicking(chunk) diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt b/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt index 2a1d23e..2c279ea 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt @@ -365,7 +365,7 @@ class Minion( } override fun getAsItem(): ItemStack { - return type.getItem(level, actions) + return type.getItem(level, actions, charge) } override fun getLevel(): Int {