init
This commit is contained in:
parent
72b3bd2033
commit
7b7849194c
|
|
@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.7.20"
|
||||
application
|
||||
id("io.izzel.taboolib") version "1.42"
|
||||
}
|
||||
|
||||
group = "cc.maxmc.blastingcrisis"
|
||||
|
|
@ -10,20 +10,33 @@ version = "1.0-SNAPSHOT"
|
|||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.maxmc.cn/repository/maven-snapshots/") {
|
||||
name = "maxmc"
|
||||
credentials(PasswordCredentials::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
testImplementation(kotlin("test"))
|
||||
implementation(kotlin("stdlib"))
|
||||
implementation("ink.ptms.core:v10800:10800")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
taboolib {
|
||||
description {
|
||||
contributors {
|
||||
name("坏黑")
|
||||
name("TONY_All")
|
||||
}
|
||||
}
|
||||
install("common", "common-5")
|
||||
install("platform-bukkit")
|
||||
install("module-nms", "module-nms-util", "module-chat")
|
||||
|
||||
options("skip-kotlin-relocate")
|
||||
version = "6.0.9-117"
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("MainKt")
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
fun main(args: Array<String>) {
|
||||
println("Hello World!")
|
||||
|
||||
// Try adding program arguments via Run/Debug configuration.
|
||||
// Learn more about running applications: https://www.jetbrains.com/help/idea/running-applications.html.
|
||||
println("Program arguments: ${args.joinToString()}")
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package cc.maxmc.blastingcrisis
|
||||
|
||||
import taboolib.common.platform.Plugin
|
||||
|
||||
object BlastingCrisis: Plugin() {
|
||||
|
||||
override fun onEnable() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package cc.maxmc.blastingcrisis.game
|
||||
|
||||
class Game {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
package cc.maxmc.blastingcrisis.game
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package cc.maxmc.blastingcrisis.game
|
||||
|
||||
class GameTeam {
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package cc.maxmc.blastingcrisis.map
|
||||
|
||||
class GameMap(val name: String,) {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package cc.maxmc.blastingcrisis.map
|
||||
|
||||
import cc.maxmc.blastingcrisis.misc.Area
|
||||
|
||||
object MapInitializer {
|
||||
|
||||
|
||||
}
|
||||
|
||||
class MapInfo(
|
||||
var name: String,
|
||||
var waitArea: Area,
|
||||
val teams: List<MapTeam>,
|
||||
val maxPlayersPerTeam: Int,
|
||||
|
||||
) {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package cc.maxmc.blastingcrisis.map
|
||||
|
||||
import cc.maxmc.blastingcrisis.misc.Area
|
||||
import org.bukkit.ChatColor
|
||||
import org.bukkit.Location
|
||||
|
||||
data class MapTeam(
|
||||
val name: String,
|
||||
val color: ChatColor,
|
||||
val spawn: Location,
|
||||
val home: Area,
|
||||
val wall: Area,
|
||||
val mine: Area,
|
||||
val sides: List<Area>,
|
||||
val teleport: Area,
|
||||
val upgrade: Location,
|
||||
)
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package cc.maxmc.blastingcrisis.misc
|
||||
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable
|
||||
import org.bukkit.configuration.serialization.SerializableAs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
@SerializableAs("Area")
|
||||
class Area(loc1: Location, loc2: Location) : ConfigurationSerializable {
|
||||
val locTop: Location
|
||||
val locMin: Location
|
||||
|
||||
constructor(map: Map<String, Any>) : this(map["locTop"] as Location, map["locMin"] as Location)
|
||||
|
||||
init {
|
||||
if (loc1.world != loc2.world) throw IllegalArgumentException("Locations must be of the same world.")
|
||||
locTop = Location(loc1.world, max(loc1.x, loc2.x), max(loc1.y, loc2.y), max(loc1.z, loc2.z))
|
||||
locMin = Location(loc1.world, min(loc1.x, loc2.x), min(loc1.y, loc2.y), min(loc1.z, loc2.z))
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the given location is in this area
|
||||
*
|
||||
* @param location location to check
|
||||
*
|
||||
* @return true if the location is in this area
|
||||
*/
|
||||
fun isInArea(location: Location): Boolean {
|
||||
if (location.world != locTop.world) return false
|
||||
if (location.x !in locTop.x..locMin.x) return false
|
||||
if (location.y !in locTop.y..locMin.y) return false
|
||||
if (location.z !in locTop.z..locMin.z) return false
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* get all locations of the blocks in this area
|
||||
*
|
||||
* @return all locations of the blocks in this area
|
||||
*/
|
||||
fun forBlocksInArea(): List<Location> {
|
||||
val blocks = arrayListOf<Location>()
|
||||
for (x in locTop.blockX..locMin.blockX) {
|
||||
for (y in locTop.blockY..locMin.blockY) {
|
||||
for (z in locTop.blockZ..locMin.blockZ) {
|
||||
blocks.add(Location(locTop.world, x.toDouble(), y.toDouble(), z.toDouble()))
|
||||
}
|
||||
}
|
||||
}
|
||||
return blocks
|
||||
}
|
||||
|
||||
/**
|
||||
* get all locations of the non air blocks in this area
|
||||
*
|
||||
* @return all locations of the non air blocks in this area
|
||||
*/
|
||||
fun forBlocksWithoutAir(): List<Location> {
|
||||
return forBlocksInArea().filter { it.block.type != Material.AIR }
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Area
|
||||
|
||||
if (locTop != other.locTop) return false
|
||||
if (locMin != other.locMin) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = locTop.hashCode()
|
||||
result = 31 * result + locMin.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun serialize() = mutableMapOf<String, Any>("locTop" to locTop, "locMin" to locMin)
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package cc.maxmc.blastingcrisis.misc
|
||||
|
||||
object GameManager {
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue