sync with remote
This commit is contained in:
parent
362941fe58
commit
97c5c1c9fb
|
|
@ -22,7 +22,6 @@ object BlastingCrisis : Plugin() {
|
||||||
override fun onEnable() {
|
override fun onEnable() {
|
||||||
info("§a| §7Loading BlastingCrisis")
|
info("§a| §7Loading BlastingCrisis")
|
||||||
DebugCommand.debug("debugcmd")
|
DebugCommand.debug("debugcmd")
|
||||||
info("§a| §7Loading BlastingCrisis")
|
|
||||||
createDefaultGame()
|
createDefaultGame()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import cc.maxmc.blastingcrisis.misc.GameManager
|
||||||
import cc.maxmc.blastingcrisis.misc.debug
|
import cc.maxmc.blastingcrisis.misc.debug
|
||||||
import cc.maxmc.blastingcrisis.misc.toPlayerLocation
|
import cc.maxmc.blastingcrisis.misc.toPlayerLocation
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent
|
import org.bukkit.event.entity.EntityExplodeEvent
|
||||||
import org.bukkit.event.player.PlayerInteractEvent
|
import org.bukkit.event.player.PlayerInteractEvent
|
||||||
import org.bukkit.event.player.PlayerMoveEvent
|
import org.bukkit.event.player.PlayerMoveEvent
|
||||||
|
|
@ -14,7 +15,7 @@ object GameListener {
|
||||||
val interactSubscribed = HashMap<Location, (PlayerInteractEvent) -> Unit>()
|
val interactSubscribed = HashMap<Location, (PlayerInteractEvent) -> Unit>()
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onMoveInTeleport(event: PlayerMoveEvent) {
|
fun portalTeleport(event: PlayerMoveEvent) {
|
||||||
if (!GameManager.currentGame.players.contains(event.player)) return
|
if (!GameManager.currentGame.players.contains(event.player)) return
|
||||||
val player = event.player
|
val player = event.player
|
||||||
val team = player.team ?: return
|
val team = player.team ?: return
|
||||||
|
|
@ -41,4 +42,10 @@ object GameListener {
|
||||||
debug("team ${teamInfo.name}'s villager damaged")
|
debug("team ${teamInfo.name}'s villager damaged")
|
||||||
} ?: throw IllegalStateException("TNT Exploded at no team, which shouldn't happen")
|
} ?: throw IllegalStateException("TNT Exploded at no team, which shouldn't happen")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
fun onBreak(breakEvent: BlockBreakEvent) {
|
||||||
|
val loc = breakEvent.block.location
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
|
||||||
val locTop: Location
|
val locTop: Location
|
||||||
val locMin: Location
|
val locMin: Location
|
||||||
|
|
||||||
|
@Suppress("unused") // Bukkit Specification
|
||||||
constructor(map: Map<String, Any>) : this(map["locTop"] as Location, map["locMin"] as Location)
|
constructor(map: Map<String, Any>) : this(map["locTop"] as Location, map["locMin"] as Location)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
@ -34,8 +35,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
|
||||||
if (location.world != locTop.world) return false
|
if (location.world != locTop.world) return false
|
||||||
if (location.x !in (locMin.x - 1)..(locTop.x + 1)) 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.y !in locMin.y..locTop.y + 1) return false
|
||||||
if (location.z !in (locMin.z - 1)..(locTop.z + 1)) return false
|
return location.z in (locMin.z - 1)..(locTop.z + 1)
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isBlockInArea(block: Block): Boolean {
|
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.world != locTop.world) return false
|
||||||
if (location.x !in locMin.x..locTop.x) return false
|
if (location.x !in locMin.x..locTop.x) return false
|
||||||
if (location.y !in locMin.y..locTop.y) return false
|
if (location.y !in locMin.y..locTop.y) return false
|
||||||
if (location.z !in locMin.z..locTop.z) return false
|
return location.z in locMin.z..locTop.z
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -101,9 +100,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
|
||||||
other as Area
|
other as Area
|
||||||
|
|
||||||
if (locTop != other.locTop) return false
|
if (locTop != other.locTop) return false
|
||||||
if (locMin != other.locMin) return false
|
return locMin == other.locMin
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue