diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/BlastingCrisis.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/BlastingCrisis.kt index f64f710..daddab7 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/BlastingCrisis.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/BlastingCrisis.kt @@ -22,7 +22,6 @@ object BlastingCrisis : Plugin() { override fun onEnable() { info("§a| §7Loading BlastingCrisis") DebugCommand.debug("debugcmd") - info("§a| §7Loading BlastingCrisis") createDefaultGame() } diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/game/GameBreakRule.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GameBreakRule.kt new file mode 100644 index 0000000..71eb3ea --- /dev/null +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GameBreakRule.kt @@ -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 + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/listener/GameListener.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/listener/GameListener.kt index 93df12b..d8d2956 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/listener/GameListener.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/listener/GameListener.kt @@ -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 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 + + } } \ No newline at end of file diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/misc/Area.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/misc/Area.kt index 2048436..2cb0ad5 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/misc/Area.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/misc/Area.kt @@ -15,6 +15,7 @@ class Area(loc1: Location, loc2: Location) : ConfigurationSerializable { val locTop: Location val locMin: Location + @Suppress("unused") // Bukkit Specification constructor(map: Map) : 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 {