sync with remote

This commit is contained in:
TONY_All 2023-06-07 14:46:26 +08:00
parent 362941fe58
commit 97c5c1c9fb
4 changed files with 31 additions and 9 deletions

View File

@ -22,7 +22,6 @@ object BlastingCrisis : Plugin() {
override fun onEnable() {
info("§a| §7Loading BlastingCrisis")
DebugCommand.debug("debugcmd")
info("§a| §7Loading BlastingCrisis")
createDefaultGame()
}

View File

@ -0,0 +1,19 @@
package cc.maxmc.blastingcrisis.game
import org.bukkit.Location
class GameBreakRule(val rule: MutableList<(Location) -> Boolean>) {
fun matchRule(location: Location) {
}
fun addRule(rule: (Location) -> Boolean) {
}
fun defaultRule() {
rule.add {
true
}
}
}

View File

@ -5,6 +5,7 @@ import cc.maxmc.blastingcrisis.misc.GameManager
import cc.maxmc.blastingcrisis.misc.debug
import cc.maxmc.blastingcrisis.misc.toPlayerLocation
import org.bukkit.Location
import org.bukkit.event.block.BlockBreakEvent
import org.bukkit.event.entity.EntityExplodeEvent
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.player.PlayerMoveEvent
@ -14,7 +15,7 @@ object GameListener {
val interactSubscribed = HashMap<Location, (PlayerInteractEvent) -> Unit>()
@SubscribeEvent
fun onMoveInTeleport(event: PlayerMoveEvent) {
fun portalTeleport(event: PlayerMoveEvent) {
if (!GameManager.currentGame.players.contains(event.player)) return
val player = event.player
val team = player.team ?: return
@ -41,4 +42,10 @@ object GameListener {
debug("team ${teamInfo.name}'s villager damaged")
} ?: throw IllegalStateException("TNT Exploded at no team, which shouldn't happen")
}
@SubscribeEvent
fun onBreak(breakEvent: BlockBreakEvent) {
val loc = breakEvent.block.location
}
}

View File

@ -15,6 +15,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
val locTop: Location
val locMin: Location
@Suppress("unused") // Bukkit Specification
constructor(map: Map<String, Any>) : this(map["locTop"] as Location, map["locMin"] as Location)
init {
@ -34,8 +35,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
if (location.world != locTop.world) return false
if (location.x !in (locMin.x - 1)..(locTop.x + 1)) return false
if (location.y !in locMin.y..locTop.y + 1) return false
if (location.z !in (locMin.z - 1)..(locTop.z + 1)) return false
return true
return location.z in (locMin.z - 1)..(locTop.z + 1)
}
fun isBlockInArea(block: Block): Boolean {
@ -43,8 +43,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
if (location.world != locTop.world) return false
if (location.x !in locMin.x..locTop.x) return false
if (location.y !in locMin.y..locTop.y) return false
if (location.z !in locMin.z..locTop.z) return false
return true
return location.z in locMin.z..locTop.z
}
/**
@ -101,9 +100,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
other as Area
if (locTop != other.locTop) return false
if (locMin != other.locMin) return false
return true
return locMin == other.locMin
}
override fun hashCode(): Int {