Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Auxilor
2021-11-12 10:15:08 +00:00
18 changed files with 99 additions and 165 deletions

View File

@@ -1,7 +1,6 @@
package com.willfp.eco.spigot.data
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.util.NamespacedKeyUtils
import org.bukkit.block.Block
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority

View File

@@ -16,13 +16,10 @@ import org.jetbrains.exposed.sql.DoubleColumnType
import org.jetbrains.exposed.sql.IntegerColumnType
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.VarCharColumnType
import org.jetbrains.exposed.sql.checkMappingConsistence
import org.jetbrains.exposed.sql.exposedLogger
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.TransactionManager
import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update
import java.util.UUID
@@ -178,27 +175,4 @@ class MySQLDataHandler(
getPlayer(uuid)
}
}
private fun createMissingTablesAndColumnsSilently(table: Table) {
with(TransactionManager.current()) {
fun execStatements(statements: List<String>) {
for (statement in statements) {
exec(statement)
}
}
db.dialect.resetCaches()
val createStatements = SchemaUtils.createStatements(table)
execStatements(createStatements)
commit()
val alterStatements = SchemaUtils.addMissingColumnsStatements(table)
execStatements(alterStatements)
commit()
val executedStatements = createStatements + alterStatements
val modifyTablesStatements = checkMappingConsistence(table).filter { it !in executedStatements }
execStatements(modifyTablesStatements)
commit()
db.dialect.resetCaches()
}
}
}

View File

@@ -63,7 +63,8 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
modifyAndSend(itemStacks, windowId, player)
} catch (e: Exception) {
if (this.getPlugin().configYml.getBool("async-display.log-errors")) {
this.getPlugin().logger.warning("Error happened in async processing! Disable async display (/plugins/eco/config.yml) if this is a frequent issue")
this.getPlugin().logger.warning("Error happened in async processing! Disable async display (/plugins/eco/config.yml)" +
"if this is a frequent issue. (Remember to disable ratelimit and emergency too)")
}
this.getPlugin().scheduler.run {
@@ -104,7 +105,7 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
return false
}
if (this.getPlugin().configYml.getBool("async-display.enabled")) {
if (this.getPlugin().configYml.getBool("async-display.always-enabled")) {
return true
}

View File

@@ -9,19 +9,19 @@ import org.bukkit.entity.Player
class AntigriefDeluxeCombat: AntigriefWrapper {
override fun getPluginName(): String {
return "DeluxeCombat";
return "DeluxeCombat"
}
override fun canBreakBlock(player: Player, block: Block): Boolean {
return true;
return true
}
override fun canCreateExplosion(player: Player, location: Location): Boolean {
return true;
return true
}
override fun canPlaceBlock(player: Player, block: Block): Boolean {
return true;
return true
}
override fun canInjure(player: Player, victim: LivingEntity): Boolean {

View File

@@ -2,10 +2,13 @@ package com.willfp.eco.spigot.integrations.antigrief
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import me.angeschossen.lands.api.flags.Flags
import me.angeschossen.lands.api.integration.LandsIntegration
import org.bukkit.Location
import org.bukkit.block.Block
import org.bukkit.entity.Animals
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Monster
import org.bukkit.entity.Player
class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper {
@@ -15,7 +18,7 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper {
block: Block
): Boolean {
val area = landsIntegration.getAreaByLoc(block.location) ?: return true
return area.isTrusted(player.uniqueId)
return area.hasFlag(player, Flags.BLOCK_BREAK, false)
}
override fun canCreateExplosion(
@@ -23,7 +26,7 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper {
location: Location
): Boolean {
val area = landsIntegration.getAreaByLoc(location) ?: return true
return area.isTrusted(player.uniqueId)
return area.hasFlag(player, Flags.ATTACK_PLAYER, false) && area.hasFlag(player, Flags.ATTACK_ANIMAL, false)
}
override fun canPlaceBlock(
@@ -31,15 +34,22 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper {
block: Block
): Boolean {
val area = landsIntegration.getAreaByLoc(block.location) ?: return true
return area.isTrusted(player.uniqueId)
return area.hasFlag(player, Flags.BLOCK_PLACE, false)
}
override fun canInjure(
player: Player,
victim: LivingEntity
): Boolean {
val area = landsIntegration.getAreaByLoc(victim.location) ?: return true
return area.isTrusted(player.uniqueId)
return when(victim) {
is Player -> area.hasFlag(player, Flags.ATTACK_PLAYER, false)
is Monster -> area.hasFlag(player, Flags.ATTACK_MONSTER, false)
is Animals -> area.hasFlag(player, Flags.ATTACK_MONSTER, false)
else -> area.isTrusted(player.uniqueId)
}
}
override fun getPluginName(): String {

View File

@@ -48,7 +48,7 @@ display-frame-ttl: 17
# are experiencing severe display lag.
async-display:
# If async display should always be used.
enabled: false
always-enabled: false
# Log errors that occur in async processing.
log-errors: true