mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-11-29 12:45:18 +01:00
Fixes
This commit is contained in:
parent
810bf22bb2
commit
7dcbb3ae64
@ -181,14 +181,19 @@ class MinionInventoryListener : Listener {
|
||||
return
|
||||
}
|
||||
|
||||
val chargeSeconds = (minion.getCharge() - System.currentTimeMillis()) / 1000
|
||||
|
||||
if ((Config.MAX_CHARGE() * 60) - chargeSeconds < 10) {
|
||||
println("Not enough time has passed!")
|
||||
return
|
||||
}
|
||||
|
||||
AxMinionsPlugin.integrations.getEconomyIntegration()?.let {
|
||||
minion.getOwner()?.let { player ->
|
||||
it.takeBalance(player, Config.CHARGE_PRICE())
|
||||
}
|
||||
}
|
||||
|
||||
val chargeSeconds = (minion.getCharge() - System.currentTimeMillis()) / 1000
|
||||
|
||||
if (chargeSeconds + Config.CHARGE_AMOUNT() > Config.MAX_CHARGE() * 60L) {
|
||||
minion.setCharge(System.currentTimeMillis() + Config.MAX_CHARGE() * 60L * 1000L)
|
||||
return
|
||||
|
@ -13,6 +13,7 @@ import com.artillexstudios.axminions.minions.Minion
|
||||
import com.artillexstudios.axminions.minions.Minions
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.block.Action
|
||||
@ -34,7 +35,9 @@ class MinionPlaceListener : Listener {
|
||||
val minionType = MinionTypes.valueOf(type) ?: return
|
||||
event.isCancelled = true
|
||||
|
||||
if (!AxMinionsPlugin.integrations.getProtectionIntegration().canBuildAt(event.player, event.clickedBlock!!.location)) {
|
||||
if (!AxMinionsPlugin.integrations.getProtectionIntegration()
|
||||
.canBuildAt(event.player, event.clickedBlock!!.location)
|
||||
) {
|
||||
if (Config.DEBUG()) {
|
||||
event.player.sendMessage(
|
||||
"Could not place due to protection hook!"
|
||||
|
@ -636,7 +636,7 @@ class Minion(
|
||||
override fun damageTool(amount: Int) {
|
||||
if (!Config.USE_DURABILITY()) return
|
||||
|
||||
if (notDurable.contains(tool?.type)) {
|
||||
if (notDurable.contains(tool?.type) && !(tool?.type?.isAir ?: return)) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -686,7 +686,7 @@ class Minion(
|
||||
}
|
||||
|
||||
override fun canUseTool(): Boolean {
|
||||
if (notDurable.contains(tool?.type)) {
|
||||
if (notDurable.contains(tool?.type) && !(tool?.type?.isAir ?: return false)) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class SellerMinionType : MinionType("seller", AxMinionsPlugin.INSTANCE.getResour
|
||||
|
||||
var price = AxMinionsPlugin.integrations.getPricesIntegration()!!.getPrice(it)
|
||||
|
||||
if (price == -1.0) {
|
||||
if (price <= 0) {
|
||||
if (getConfig().get("delete-unsellable")) {
|
||||
it.amount = 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user