mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-11-25 12:05:56 +01:00
Add lumber break limit
This commit is contained in:
parent
c313d8f638
commit
e181fa6f77
@ -50,6 +50,8 @@ class Config(file: File, stream: InputStream) {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun WORK_WHEN_OWNER_OFFLINE() = AxMinionsAPI.INSTANCE.getConfig().get<Boolean>("work-when-owner-offline", true)
|
fun WORK_WHEN_OWNER_OFFLINE() = AxMinionsAPI.INSTANCE.getConfig().get<Boolean>("work-when-owner-offline", true)
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
fun MAX_BREAKS_PER_TICK() = AxMinionsAPI.INSTANCE.getConfig().get<Int>("max-breaks-per-tick", 200)
|
||||||
|
@JvmStatic
|
||||||
fun DEBUG(): Boolean {
|
fun DEBUG(): Boolean {
|
||||||
if (debug === null) {
|
if (debug === null) {
|
||||||
debug = AxMinionsAPI.INSTANCE.getConfig().get("debug", false)
|
debug = AxMinionsAPI.INSTANCE.getConfig().get("debug", false)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.artillexstudios.axminions.api.utils
|
package com.artillexstudios.axminions.api.utils
|
||||||
|
|
||||||
|
import com.artillexstudios.axminions.api.config.Config
|
||||||
import java.util.LinkedList
|
import java.util.LinkedList
|
||||||
import java.util.Queue
|
import java.util.Queue
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
@ -65,6 +66,8 @@ object MinionUtils {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getTree(startBlock: Block): Set<Block> {
|
fun getTree(startBlock: Block): Set<Block> {
|
||||||
|
val max: Int = Config.MAX_BREAKS_PER_TICK()
|
||||||
|
var count: Int = 0
|
||||||
val queue: Queue<Block> = LinkedList()
|
val queue: Queue<Block> = LinkedList()
|
||||||
val visited = mutableSetOf<Block>()
|
val visited = mutableSetOf<Block>()
|
||||||
val tree = mutableSetOf<Block>()
|
val tree = mutableSetOf<Block>()
|
||||||
@ -76,6 +79,10 @@ object MinionUtils {
|
|||||||
|
|
||||||
val type = block.type.toString()
|
val type = block.type.toString()
|
||||||
if (type.endsWith("_WOOD") || type.endsWith("_LOG")) {
|
if (type.endsWith("_WOOD") || type.endsWith("_LOG")) {
|
||||||
|
if (count >= max) {
|
||||||
|
return tree
|
||||||
|
}
|
||||||
|
count++
|
||||||
tree.add(block)
|
tree.add(block)
|
||||||
|
|
||||||
FACES.fastFor {
|
FACES.fastFor {
|
||||||
|
@ -7,7 +7,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.artillexstudios.axminions'
|
group = 'com.artillexstudios.axminions'
|
||||||
version = '1.0.6'
|
version = '1.0.7'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -129,7 +129,6 @@ allprojects {
|
|||||||
compileOnly 'com.palmergames.bukkit.towny:towny:0.100.1.0'
|
compileOnly 'com.palmergames.bukkit.towny:towny:0.100.1.0'
|
||||||
implementation platform('com.intellectualsites.bom:bom-newest:1.35')
|
implementation platform('com.intellectualsites.bom:bom-newest:1.35')
|
||||||
implementation("com.artillexstudios.axapi:axapi:1.4.87")
|
implementation("com.artillexstudios.axapi:axapi:1.4.87")
|
||||||
implementation("net.byteflux:libby-bukkit:1.3.0")
|
|
||||||
implementation("com.zaxxer:HikariCP:5.1.0")
|
implementation("com.zaxxer:HikariCP:5.1.0")
|
||||||
implementation("org.bstats:bstats-bukkit:3.0.2")
|
implementation("org.bstats:bstats-bukkit:3.0.2")
|
||||||
compileOnly 'org.black_ixx:playerpoints:3.2.6'
|
compileOnly 'org.black_ixx:playerpoints:3.2.6'
|
||||||
|
@ -34,8 +34,8 @@ import com.artillexstudios.axminions.minions.miniontype.MinerMinionType
|
|||||||
import com.artillexstudios.axminions.minions.miniontype.SellerMinionType
|
import com.artillexstudios.axminions.minions.miniontype.SellerMinionType
|
||||||
import com.artillexstudios.axminions.minions.miniontype.SlayerMinionType
|
import com.artillexstudios.axminions.minions.miniontype.SlayerMinionType
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import net.byteflux.libby.BukkitLibraryManager
|
import com.artillexstudios.axapi.libs.libby.BukkitLibraryManager
|
||||||
import net.byteflux.libby.Library
|
import com.artillexstudios.axapi.libs.libby.Library
|
||||||
import org.bstats.bukkit.Metrics
|
import org.bstats.bukkit.Metrics
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import revxrsal.commands.bukkit.BukkitCommandHandler
|
import revxrsal.commands.bukkit.BukkitCommandHandler
|
||||||
|
@ -42,6 +42,9 @@ pull-tools-from-chest: false
|
|||||||
# If the minion should work when the owner is offline (only if the chunk is loaded)
|
# If the minion should work when the owner is offline (only if the chunk is loaded)
|
||||||
work-when-owner-offline: true
|
work-when-owner-offline: true
|
||||||
|
|
||||||
|
# The maximum amount of blocks a single lumber minion may break at a time
|
||||||
|
max-breaks-per-tick: 200
|
||||||
|
|
||||||
# What type of message we should send when the upgrade fails
|
# What type of message we should send when the upgrade fails
|
||||||
# due to insufficient funds
|
# due to insufficient funds
|
||||||
# Possible options: chat, title, subtitle, actionbar
|
# Possible options: chat, title, subtitle, actionbar
|
||||||
@ -98,4 +101,4 @@ gui:
|
|||||||
debug: false
|
debug: false
|
||||||
|
|
||||||
# Do not change!
|
# Do not change!
|
||||||
config-version: 4
|
config-version: 5
|
Loading…
Reference in New Issue
Block a user