mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-11-22 11:35:19 +01:00
Fixes, update AxAPI to handle 1.20.2, smaller filesize, only-owner-gui config option
This commit is contained in:
parent
ac2a1a3cb3
commit
382c33cd4f
@ -22,6 +22,8 @@ class Config(file: File, stream: InputStream) {
|
||||
@JvmStatic
|
||||
fun ONLY_OWNER_BREAK() = AxMinionsAPI.INSTANCE.getConfig().get("only-owner-break", true)
|
||||
@JvmStatic
|
||||
fun ONLY_OWNER_GUI() = AxMinionsAPI.INSTANCE.getConfig().get("only-owner-gui", true)
|
||||
@JvmStatic
|
||||
fun DISPLAY_WARNINGS() = AxMinionsAPI.INSTANCE.getConfig().get("display-warnings", true)
|
||||
@JvmStatic
|
||||
fun CAN_BREAK_TOOLS() = AxMinionsAPI.INSTANCE.getConfig().get("can-break-tools", true)
|
||||
|
@ -94,28 +94,18 @@ class Minion(
|
||||
entity.setHasArms(true)
|
||||
|
||||
entity.onClick { event ->
|
||||
Scheduler.get().execute {
|
||||
Scheduler.get().run {
|
||||
if (event.isAttack) {
|
||||
if (ownerUUID == event.player.uniqueId && Config.ONLY_OWNER_BREAK()) {
|
||||
if (ownerUUID == event.player.uniqueId) {
|
||||
breakMinion(event)
|
||||
} else if (AxMinionsPlugin.integrations.getProtectionIntegration()
|
||||
.canBuildAt(
|
||||
event.player,
|
||||
event.packetEntity.location
|
||||
) || event.player.hasPermission("axminions.*")
|
||||
) {
|
||||
} else if ((AxMinionsPlugin.integrations.getProtectionIntegration().canBuildAt(event.player, event.packetEntity.location) && !Config.ONLY_OWNER_BREAK()) || event.player.hasPermission("axminions.*")) {
|
||||
breakMinion(event)
|
||||
}
|
||||
} else {
|
||||
if (ownerUUID == event.player.uniqueId || AxMinionsPlugin.integrations.getProtectionIntegration()
|
||||
.canBuildAt(
|
||||
event.player,
|
||||
event.packetEntity.location
|
||||
) || event.player.hasPermission("axminions.*")
|
||||
) {
|
||||
Scheduler.get().run {
|
||||
openInventory(event.player)
|
||||
}
|
||||
if (ownerUUID == event.player.uniqueId) {
|
||||
openInventory(event.player)
|
||||
} else if ((AxMinionsPlugin.integrations.getProtectionIntegration().canBuildAt(event.player, event.packetEntity.location) && !Config.ONLY_OWNER_GUI()) || event.player.hasPermission("axminions.*")) {
|
||||
openInventory(event.player)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,9 @@ class CollectorMinionType : MinionType("collector", AxMinionsPlugin.INSTANCE.get
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() == null) {
|
||||
Warnings.NO_CONTAINER.display(minion)
|
||||
|
@ -29,7 +29,9 @@ class FarmerMinionType : MinionType("farmer", AxMinionsPlugin.INSTANCE.getResour
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() != null) {
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
|
@ -29,7 +29,9 @@ class FisherMinionType : MinionType("fisher", AxMinionsPlugin.INSTANCE.getResour
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() != null) {
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
|
@ -29,7 +29,9 @@ class LumberMinionType : MinionType("lumber", AxMinionsPlugin.INSTANCE.getResour
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() != null) {
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
|
@ -35,7 +35,9 @@ class MinerMinionType : MinionType("miner", AxMinionsPlugin.INSTANCE.getResource
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() != null) {
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
|
@ -24,7 +24,9 @@ class SellerMinionType : MinionType("seller", AxMinionsPlugin.INSTANCE.getResour
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() == null) {
|
||||
Warnings.NO_CONTAINER.display(minion)
|
||||
|
@ -29,7 +29,9 @@ class SlayerMinionType : MinionType("slayer", AxMinionsPlugin.INSTANCE.getResour
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
if (minion.getLinkedInventory() != null && minion.getLinkedInventory()?.firstEmpty() != -1) {
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() != null) {
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
|
@ -15,6 +15,11 @@ default-minion-limit: 5
|
||||
# You should enable this, if you aren't using a supported protection plugin!
|
||||
only-owner-break: true
|
||||
|
||||
# If true, only the owner of this minion can open it's GUI
|
||||
# If false, everyone, who can break blocks at said location can open the GUI of this minion
|
||||
# You should enable this, if you aren't using a supported protection plugin!
|
||||
only-owner-gui: true
|
||||
|
||||
# Should minions show holograms if they have an issue?
|
||||
# (They won't complain about not having a girlfriend, though!)
|
||||
# You can configure these messages in the messages.yml
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user