Rebase on version 5
This commit is contained in:
1 parent
5f9b0af8d1
commit
f246094915
53 files changed
+449
-4030
No files matched your search
@@ -0,0 +1,4 @@
|
||||
kotlin version: 2.0.21
|
||||
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
|
||||
1. Kotlin compile daemon is ready
|
||||
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id 'org.mvplugins.multiverse-plugin' version '1.2.2'
|
||||
}
|
||||
|
||||
group = 'org.mvplugins.multiverse.core'
|
||||
description = 'Multiverse-Core'
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = 'aikar repo'
|
||||
url = uri('https://repo.aikar.co/content/groups/aikar/')
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'glaremasters repo'
|
||||
url = 'https://repo.glaremasters.me/repository/towny/'
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "helpchatRepoReleases"
|
||||
url = uri("https://repo.helpch.at/releases/")
|
||||
}
|
||||
}
|
||||
|
||||
configure(apiDependencies) {
|
||||
serverApiVersion = '1.21.8-R0.1-SNAPSHOT'
|
||||
mockBukkitServerApiVersion = '1.21'
|
||||
mockBukkitVersion = '4.84.0'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Economy
|
||||
externalPlugin('com.github.MilkBowl:VaultAPI:1.7.1') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
|
||||
// PlaceholderAPI
|
||||
externalPlugin 'me.clip:placeholderapi:2.11.6'
|
||||
|
||||
// Command Framework
|
||||
shadowed 'co.aikar:acf-paper:0.5.1-SNAPSHOT'
|
||||
|
||||
// Config
|
||||
shadowed('io.github.townyadvanced.commentedconfiguration:CommentedConfiguration:1.0.1') {
|
||||
exclude group: 'org.spigotmc', module: 'spigot-api'
|
||||
}
|
||||
|
||||
// Utils
|
||||
shadowed 'io.vavr:vavr:0.10.7'
|
||||
shadowed 'org.glassfish.hk2:hk2-locator:3.1.1'
|
||||
shadowed('org.glassfish.hk2:hk2-inhabitant-generator:3.1.1') {
|
||||
exclude group: 'org.apache.maven', module: 'maven-core'
|
||||
}
|
||||
shadowed('com.dumptruckman.minecraft:Logging:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
shadowed 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
|
||||
shadowed('org.bstats:bstats-bukkit:3.1.0') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
shadowed 'net.minidev:json-smart:2.5.2'
|
||||
shadowed 'org.jetbrains:annotations:26.0.2'
|
||||
shadowed 'io.papermc:paperlib:1.0.8'
|
||||
|
||||
// Tests
|
||||
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
testImplementation("org.hamcrest:hamcrest:3.0")
|
||||
}
|
||||
|
||||
ext.bitlyAccessToken = System.getenv('BITLY_ACCESS_TOKEN') ?: 'bitly-access-token'
|
||||
|
||||
tasks.register('prepareSource', Sync) {
|
||||
inputs.property 'bitlyAccessToken', bitlyAccessToken
|
||||
from sourceSets.main.java
|
||||
into "$buildDir/src"
|
||||
filter(ReplaceTokens, tokens: [
|
||||
'bitly-access-token': bitlyAccessToken,
|
||||
])
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
relocate 'co.aikar', 'org.mvplugins.multiverse.external.acf'
|
||||
relocate 'com.dumptruckman.minecraft.util.Logging', 'org.mvplugins.multiverse.core.utils.CoreLogging'
|
||||
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'org.mvplugins.multiverse.core.utils.DebugFileLogger'
|
||||
relocate 'de.themoep.idconverter', 'org.mvplugins.multiverse.external.idconverter'
|
||||
relocate 'io.github.townyadvanced.commentedconfiguration', 'org.mvplugins.multiverse.external.commentedconfiguration'
|
||||
relocate 'org.bstats', 'org.mvplugins.multiverse.external.bstats'
|
||||
relocate 'com.sun', 'org.mvplugins.multiverse.external.sun'
|
||||
relocate 'net.minidev', 'org.mvplugins.multiverse.external.minidev'
|
||||
relocate 'org.objectweb', 'org.mvplugins.multiverse.external.objectweb'
|
||||
relocate 'io.vavr', 'org.mvplugins.multiverse.external.vavr'
|
||||
relocate 'jakarta', 'org.mvplugins.multiverse.external.jakarta'
|
||||
relocate 'javassist', 'org.mvplugins.multiverse.external.javassist'
|
||||
relocate 'org.aopalliance', 'org.mvplugins.multiverse.external.aopalliance'
|
||||
relocate 'org.glassfish', 'org.mvplugins.multiverse.external.glassfish'
|
||||
relocate 'org.jvnet', 'org.mvplugins.multiverse.external.jvnet'
|
||||
relocate 'org.intellij', 'org.mvplugins.multiverse.external.intellij'
|
||||
relocate 'org.jetbrains', 'org.mvplugins.multiverse.external.jetbrains'
|
||||
relocate 'io.papermc.lib', 'org.mvplugins.multiverse.external.paperlib'
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core"
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import groovy.util.Node
|
||||
import groovy.util.NodeList
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.credentials.PasswordCredentials
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.api.tasks.Sync
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
eclipse
|
||||
`maven-publish`
|
||||
id("com.gradleup.shadow") version "8.3.9"
|
||||
kotlin("jvm") version "2.0.21"
|
||||
}
|
||||
|
||||
group = "org.mvplugins.multiverse.core"
|
||||
version = System.getenv("GITHUB_VERSION") ?: "local"
|
||||
description = "Multiverse-Core"
|
||||
|
||||
val sourceSets = extensions.getByType<SourceSetContainer>()
|
||||
|
||||
val serverApi: Configuration by configurations.creating
|
||||
val externalPlugin: Configuration by configurations.creating
|
||||
val shadowed: Configuration by configurations.creating
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://repo.onarandombox.com/content/groups/public")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/groups/public/")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://repo.minebench.de/")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://repo.maven.apache.org/maven2/")
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "aikar repo"
|
||||
url = uri("https://repo.aikar.co/content/groups/aikar/")
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "glaremasters repo"
|
||||
url = uri("https://repo.glaremasters.me/repository/towny/")
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "helpchatRepoReleases"
|
||||
url = uri("https://repo.helpch.at/releases/")
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "papermc repo"
|
||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
// Purpur API
|
||||
maven("https://repo.purpurmc.org/snapshots")
|
||||
}
|
||||
|
||||
// Configuration wiring like in the Groovy build
|
||||
configurations["compileOnly"].extendsFrom(serverApi)
|
||||
configurations["runtimeClasspath"].extendsFrom(serverApi)
|
||||
|
||||
configurations["implementation"].extendsFrom(externalPlugin)
|
||||
|
||||
configurations["compileClasspath"].extendsFrom(shadowed)
|
||||
configurations["testCompileClasspath"].extendsFrom(shadowed)
|
||||
configurations["testRuntimeClasspath"].extendsFrom(shadowed)
|
||||
|
||||
dependencies {
|
||||
// Server API: Purpur 1.19.4
|
||||
serverApi("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
|
||||
|
||||
// Economy
|
||||
externalPlugin("com.github.MilkBowl:VaultAPI:1.7.1") {
|
||||
exclude(group = "org.bukkit", module = "bukkit")
|
||||
}
|
||||
|
||||
// PlaceholderAPI
|
||||
externalPlugin("me.clip:placeholderapi:2.11.6")
|
||||
|
||||
// Command Framework
|
||||
shadowed("co.aikar:acf-paper:0.5.1-SNAPSHOT")
|
||||
|
||||
// Config
|
||||
shadowed("io.github.townyadvanced.commentedconfiguration:CommentedConfiguration:1.0.1") {
|
||||
exclude(group = "org.spigotmc", module = "spigot-api")
|
||||
}
|
||||
|
||||
// Utils
|
||||
shadowed("io.vavr:vavr:0.10.4")
|
||||
shadowed("org.glassfish.hk2:hk2-locator:3.0.3")
|
||||
shadowed("org.glassfish.hk2:hk2-inhabitant-generator:3.0.3") {
|
||||
exclude(group = "org.apache.maven", module = "maven-core")
|
||||
}
|
||||
shadowed("com.dumptruckman.minecraft:Logging:1.1.1") {
|
||||
exclude(group = "junit", module = "junit")
|
||||
}
|
||||
shadowed("de.themoep.idconverter:mappings:1.2-SNAPSHOT")
|
||||
shadowed("org.bstats:bstats-bukkit:3.1.0") {
|
||||
exclude(group = "org.bukkit", module = "bukkit")
|
||||
}
|
||||
shadowed("net.minidev:json-smart:2.4.9")
|
||||
shadowed("org.jetbrains:annotations:22.0.0")
|
||||
shadowed("io.papermc:paperlib:1.0.8")
|
||||
|
||||
// Tests
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21")
|
||||
testImplementation("com.github.seeseemelk:MockBukkit-v1.19:3.1.0")
|
||||
testImplementation("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
exclude(group = "junit", module = "junit")
|
||||
}
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||
testImplementation("com.natpryce:hamkrest:1.8.0.1")
|
||||
testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
|
||||
|
||||
// Annotation Processors
|
||||
annotationProcessor("org.glassfish.hk2:hk2-metadata-generator:3.0.3")
|
||||
testAnnotationProcessor("org.glassfish.hk2:hk2-metadata-generator:3.0.3")
|
||||
}
|
||||
|
||||
java {
|
||||
// Plugin is compiled for Java 17 (GraalVM 17-friendly)
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
val bitlyAccessToken: String = System.getenv("BITLY_ACCESS_TOKEN") ?: "bitly-access-token"
|
||||
|
||||
// === Token-filtered source generation (prepareSource) ===
|
||||
val prepareSource by tasks.registering(Sync::class) {
|
||||
inputs.property("bitlyAccessToken", bitlyAccessToken)
|
||||
from(sourceSets["main"].java)
|
||||
// avoid deprecated buildDir getter
|
||||
into(layout.buildDirectory.dir("src"))
|
||||
filter<ReplaceTokens>(
|
||||
"tokens" to mapOf(
|
||||
"bitly-access-token" to bitlyAccessToken,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
// Use ONLY the filtered sources for compileJava (fixes duplicate classes)
|
||||
tasks.named<JavaCompile>("compileJava") {
|
||||
dependsOn(prepareSource)
|
||||
source = prepareSource.get().outputs.files.asFileTree
|
||||
sourceCompatibility = JavaVersion.VERSION_17.toString()
|
||||
targetCompatibility = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
tasks.named<JavaCompile>("compileTestJava") {
|
||||
sourceCompatibility = JavaVersion.VERSION_17.toString()
|
||||
targetCompatibility = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
options.compilerArgs.add(
|
||||
"-Aorg.glassfish.hk2.metadata.location=META-INF/hk2-locator/Multiverse-Core",
|
||||
)
|
||||
}
|
||||
|
||||
tasks.withType<Javadoc>().configureEach {
|
||||
(options as StandardJavadocDocletOptions).encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.named<KotlinCompile>("compileTestKotlin") {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
javaParameters.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
// We're not using Kotlin in the plugin itself, just tests!
|
||||
tasks.named<KotlinCompile>("compileKotlin") {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
configurations
|
||||
.filterNot { it.name.startsWith("test") }
|
||||
.forEach {
|
||||
it.exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
||||
}
|
||||
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
val props = mapOf("version" to project.version.toString())
|
||||
inputs.properties(props)
|
||||
filteringCharset = "UTF-8"
|
||||
filesMatching("plugin.yml") {
|
||||
expand(props)
|
||||
}
|
||||
// Never up-to-date: tests depend on fresh version expansion
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
tasks.named<Javadoc>("javadoc") {
|
||||
source = sourceSets["main"].allJava
|
||||
classpath = configurations["compileClasspath"]
|
||||
}
|
||||
|
||||
// Removed: configurations["api"].isCanBeResolved = true (deprecated in Gradle 8/9)
|
||||
|
||||
val jarTask = tasks.named<Jar>("jar")
|
||||
val shadowJarTask = tasks.named<ShadowJar>("shadowJar")
|
||||
|
||||
listOf("apiElements", "runtimeElements").forEach { configurationName ->
|
||||
configurations.named(configurationName) {
|
||||
outgoing.artifacts.removeIf { artifact ->
|
||||
artifact.buildDependencies.getDependencies(null).contains(jarTask.get())
|
||||
}
|
||||
outgoing.artifact(shadowJarTask)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate("co.aikar", "org.mvplugins.multiverse.external.acf")
|
||||
relocate("com.dumptruckman.minecraft.util.Logging", "org.mvplugins.multiverse.core.utils.CoreLogging")
|
||||
relocate("com.dumptruckman.minecraft.util.DebugLog", "org.mvplugins.multiverse.core.utils.DebugFileLogger")
|
||||
relocate("de.themoep.idconverter", "org.mvplugins.multiverse.external.idconverter")
|
||||
relocate("io.github.townyadvanced.commentedconfiguration", "org.mvplugins.multiverse.external.commentedconfiguration")
|
||||
relocate("me.main__.util", "org.mvplugins.multiverse.external.serializationconfig")
|
||||
relocate("org.bstats", "org.mvplugins.multiverse.external.bstats")
|
||||
relocate("com.sun", "org.mvplugins.multiverse.external.sun")
|
||||
relocate("net.minidev", "org.mvplugins.multiverse.external.minidev")
|
||||
relocate("org.objectweb", "org.mvplugins.multiverse.external.objectweb")
|
||||
relocate("io.vavr", "org.mvplugins.multiverse.external.vavr")
|
||||
relocate("jakarta", "org.mvplugins.multiverse.external.jakarta")
|
||||
relocate("javassist", "org.mvplugins.multiverse.external.javassist")
|
||||
relocate("org.aopalliance", "org.mvplugins.multiverse.external.aopalliance")
|
||||
relocate("org.glassfish", "org.mvplugins.multiverse.external.glassfish")
|
||||
relocate("org.jvnet", "org.mvplugins.multiverse.external.jvnet")
|
||||
relocate("org.intellij", "org.mvplugins.multiverse.external.intellij")
|
||||
relocate("org.jetbrains", "org.mvplugins.multiverse.external.jetbrains")
|
||||
relocate("io.papermc.lib", "org.mvplugins.multiverse.external.paperlib")
|
||||
|
||||
configurations = listOf(project.configurations["shadowed"])
|
||||
|
||||
archiveClassifier.set("")
|
||||
|
||||
dependencies {
|
||||
exclude { dependency ->
|
||||
dependency.moduleGroup == "org.jetbrains.kotlin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("build") {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.named<Test>("test") {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
exceptionFormat = TestExceptionFormat.FULL
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
|
||||
pom.withXml {
|
||||
val pomNode = asNode()
|
||||
|
||||
val dependenciesNode = (
|
||||
(pomNode.get("dependencies") as? NodeList)
|
||||
?.firstOrNull() as? Node
|
||||
) ?: (pomNode.appendNode("dependencies") as Node)
|
||||
|
||||
val dependencyNodes = dependenciesNode.children().filterIsInstance<Node>().toList()
|
||||
|
||||
// Remove Kotlin dependency
|
||||
dependencyNodes
|
||||
.filter { dependencyNode ->
|
||||
val groupIdNodes = dependencyNode.get("groupId") as? NodeList ?: return@filter false
|
||||
val groupId = (groupIdNodes.firstOrNull() as? Node)?.text()
|
||||
groupId == "org.jetbrains.kotlin"
|
||||
}
|
||||
.forEach { dependencyNode ->
|
||||
dependenciesNode.remove(dependencyNode)
|
||||
}
|
||||
|
||||
// Switch runtime deps to provided
|
||||
dependencyNodes.forEach { dependencyNode ->
|
||||
val scopeNodes = dependencyNode.get("scope") as? NodeList ?: return@forEach
|
||||
val scopeNode = scopeNodes.firstOrNull() as? Node ?: return@forEach
|
||||
if (scopeNode.text() == "runtime") {
|
||||
scopeNode.setValue("provided")
|
||||
}
|
||||
}
|
||||
|
||||
// Add server API (Purpur) to pom as provided
|
||||
configurations["serverApi"].allDependencies.forEach { dependency ->
|
||||
val depNode = dependenciesNode.appendNode("dependency")
|
||||
depNode.appendNode("groupId", dependency.group)
|
||||
depNode.appendNode("artifactId", dependency.name)
|
||||
depNode.appendNode("version", dependency.version)
|
||||
depNode.appendNode("scope", "provided")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/Multiverse/Multiverse-Core")
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "multiverse"
|
||||
val releasesRepoUrl = uri("https://repo.dumptruckman.com/multiverse-releases")
|
||||
val snapshotsRepoUrl = uri("https://repo.dumptruckman.com/multiverse-snapshots")
|
||||
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
|
||||
maven {
|
||||
// todo: remove before mv5 release
|
||||
name = "multiverseBeta"
|
||||
url = uri("https://repo.c0ding.party/multiverse-beta")
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -83,10 +85,9 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,10 +134,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Vendored
+12
-10
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url = uri('https://repo.onarandombox.com/multiverse-releases')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'multiverse-core'
|
||||
@@ -0,0 +1,11 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url = uri("https://repo.onarandombox.com/multiverse-releases")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "multiverse-core"
|
||||
|
||||
+8
-5
@@ -238,12 +238,15 @@ public final class AsyncSafetyTeleporterAction {
|
||||
@NotNull Location location,
|
||||
@NotNull List<Entity> passengers
|
||||
) {
|
||||
List<Entity> toTeleport = new ArrayList<>(passengers);
|
||||
toTeleport.addFirst(teleportee);
|
||||
List<Entity> toTeleport = new ArrayList<>(passengers.size() + 1);
|
||||
toTeleport.add(teleportee);
|
||||
toTeleport.addAll(passengers);
|
||||
|
||||
return AsyncAttemptsAggregate.allOfAggregate(toTeleport.stream()
|
||||
.map(passenger -> doAsyncTeleport(passenger, location))
|
||||
.toList())
|
||||
return AsyncAttemptsAggregate.allOfAggregate(
|
||||
toTeleport.stream()
|
||||
.map(passenger -> doAsyncTeleport(passenger, location))
|
||||
.toList()
|
||||
)
|
||||
.onSuccess(() -> Bukkit.getScheduler().runTask(multiverseCore, () -> {
|
||||
passengers.forEach(teleportee::addPassenger);
|
||||
Logging.finer("Mounted %d passengers to %s", passengers.size(), teleportee.getName());
|
||||
|
||||
@@ -176,7 +176,7 @@ public final class WorldManager {
|
||||
private void removeWorldsNotInConfigs(Collection<String> removedWorlds) {
|
||||
removedWorlds.forEach(worldName -> getWorld(worldName)
|
||||
.map(world -> removeWorld(RemoveWorldOptions.world(world)))
|
||||
.getOrElse(() -> worldActionResult(RemoveFailureReason.WORLD_NON_EXISTENT, worldName))
|
||||
.getOrElse(() -> worldActionResult(RemoveFailureReason.UNLOAD_FAILED, worldName))
|
||||
.onFailure(failure ->
|
||||
Logging.severe("Failed to unload world %s: %s", worldName, failure))
|
||||
.onSuccess(success ->
|
||||
@@ -891,9 +891,7 @@ public final class WorldManager {
|
||||
}).onFailure(exception -> {
|
||||
Logging.severe("Failed to create bukkit world: " + worldCreator.name());
|
||||
exception.printStackTrace();
|
||||
}).andFinally(() -> {
|
||||
this.loadTracker.remove(worldCreator.name());
|
||||
}).fold(throwable -> Attempt.failure(WorldCreatorFailureReason.BUKKIT_CREATION_FAILED,
|
||||
}).andFinally(() -> this.loadTracker.remove(worldCreator.name())).fold(throwable -> Attempt.failure(WorldCreatorFailureReason.BUKKIT_CREATION_FAILED,
|
||||
Replace.WORLD.with(worldCreator.name()),
|
||||
Replace.ERROR.with(throwable)),
|
||||
Attempt::success);
|
||||
|
||||
+25
-21
@@ -1,36 +1,40 @@
|
||||
package org.mvplugins.multiverse.core.world.biomeprovider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A parser for {@link SingleBiomeProvider}
|
||||
*/
|
||||
final class SingleBiomeProviderParser implements BiomeProviderParser {
|
||||
|
||||
private List<String> biomes;
|
||||
private List<String> biomes;
|
||||
|
||||
@Override
|
||||
public BiomeProvider parseBiomeProvider(@NotNull String worldName, @NotNull String params) {
|
||||
NamespacedKey biomeKey = NamespacedKey.fromString(params.toLowerCase(Locale.ENGLISH));
|
||||
return new SingleBiomeProvider(Registry.BIOME.get(biomeKey));
|
||||
}
|
||||
@Override
|
||||
public BiomeProvider parseBiomeProvider(@NotNull String worldName, @NotNull String params) {
|
||||
final NamespacedKey biomeKey = NamespacedKey.fromString(StringUtils.lowerCase(params, Locale.ENGLISH));
|
||||
return new SingleBiomeProvider(Registry.BIOME.get(biomeKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> suggestParams(@NotNull String currentInput) {
|
||||
if (biomes == null) {
|
||||
biomes = Registry.BIOME.stream()
|
||||
.map(biome -> biome.getKey().getKey().toLowerCase(Locale.ENGLISH))
|
||||
.toList();
|
||||
}
|
||||
return biomes;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Collection<String> suggestParams(@NotNull String currentInput) {
|
||||
if (biomes == null) {
|
||||
final List<String> result = new ArrayList<>();
|
||||
for (Biome biome : Registry.BIOME) {
|
||||
result.add(StringUtils.lowerCase(biome.getKey().getKey(), Locale.ENGLISH));
|
||||
}
|
||||
biomes = result;
|
||||
}
|
||||
return biomes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package org.mvplugins.multiverse.core
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
open class MockBukkitTest : TestWithMockBukkit() {
|
||||
|
||||
@Test
|
||||
fun `MockBukkit loads the plugin`() {
|
||||
assertNotNull(multiverseCore)
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package org.mvplugins.multiverse.core
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.configuration.MemorySection
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
import org.mockbukkit.mockbukkit.MockBukkit
|
||||
import org.mvplugins.multiverse.core.inject.PluginServiceLocator
|
||||
import org.mvplugins.multiverse.core.mock.MVServerMock
|
||||
import kotlin.test.*
|
||||
|
||||
/**
|
||||
* Basic abstract test class that sets up MockBukkit and MultiverseCore.
|
||||
*/
|
||||
abstract class TestWithMockBukkit {
|
||||
|
||||
protected lateinit var server: MVServerMock
|
||||
protected lateinit var multiverseCore: MultiverseCore
|
||||
protected lateinit var serviceLocator : PluginServiceLocator
|
||||
|
||||
@BeforeTest
|
||||
fun setUpMockBukkit() {
|
||||
TestingMode.enable()
|
||||
server = MockBukkit.mock(MVServerMock())
|
||||
multiverseCore = MockBukkit.load(MultiverseCore::class.java)
|
||||
Logging.setDebugLevel(3)
|
||||
serviceLocator = multiverseCore.serviceLocator
|
||||
assertNotNull(server.commandMap)
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
fun tearDownMockBukkit() {
|
||||
MockBukkit.unmock()
|
||||
}
|
||||
|
||||
fun getResourceAsText(path: String): String? = object {}.javaClass.getResource(path)?.readText()
|
||||
|
||||
fun writeResourceFileToPluginDataFolder(resourcePath: String, dataPath: String) {
|
||||
val resourceString = getResourceAsText(resourcePath)
|
||||
assertNotNull(resourceString)
|
||||
multiverseCore.dataFolder.toPath().resolve(dataPath).toFile().writeText(resourceString)
|
||||
}
|
||||
|
||||
fun assertConfigEquals(expectedPath: String, actualPath: String) {
|
||||
val actualString = multiverseCore.dataFolder.toPath().resolve(actualPath).toFile().readText()
|
||||
val expectedString = getResourceAsText(expectedPath)
|
||||
assertNotNull(expectedString)
|
||||
|
||||
val actualYaml = YamlConfiguration()
|
||||
actualYaml.loadFromString(actualString)
|
||||
val actualYamlKeys = HashSet(actualYaml.getKeys(true))
|
||||
|
||||
val expectedYaml = YamlConfiguration()
|
||||
expectedYaml.loadFromString(expectedString)
|
||||
val expectedYamlKeys = HashSet(expectedYaml.getKeys(true))
|
||||
|
||||
for (key in expectedYamlKeys) {
|
||||
assertNotNull(actualYamlKeys.remove(key), "Key $key is missing in actual config")
|
||||
val actualValue = actualYaml.get(key)
|
||||
if (actualValue is MemorySection) {
|
||||
continue
|
||||
}
|
||||
assertEquals(expectedYaml.get(key), actualYaml.get(key), "Value for $key is different.")
|
||||
}
|
||||
for (key in actualYamlKeys) {
|
||||
assertNull(actualYaml.get(key), "Key $key is present in actual config when it should be empty.")
|
||||
}
|
||||
|
||||
assertEquals(0, actualYamlKeys.size,
|
||||
"Actual config has more keys than expected config. The following keys are missing: $actualYamlKeys")
|
||||
}
|
||||
|
||||
fun assertLocationEquals(expected: Location?, actual: Location?) {
|
||||
assertEquals(expected?.world, actual?.world, "Worlds don't match for location comparison ($expected, $actual)")
|
||||
assertEquals(expected?.x, actual?.x, "X values don't match for location comparison ($expected, $actual)")
|
||||
assertEquals(expected?.y, actual?.y, "Y values don't match for location comparison ($expected, $actual)")
|
||||
assertEquals(expected?.z, actual?.z, "Z values don't match for location comparison ($expected, $actual)")
|
||||
assertEquals(expected?.yaw, actual?.yaw, "Yaw values don't match for location comparison ($expected, $actual)")
|
||||
assertEquals(expected?.pitch, actual?.pitch, "Pitch values don't match for location comparison ($expected, $actual)")
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.anchor
|
||||
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.world.location.UnloadedWorldLocation
|
||||
import kotlin.test.*
|
||||
|
||||
class AnchorManagerTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var anchorManager: AnchorManager
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
anchorManager = serviceLocator.getActiveService(AnchorManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("AnchorManager is not available as a service") }
|
||||
|
||||
writeResourceFileToPluginDataFolder("/anchors/default_anchors.yml", "anchors.yml")
|
||||
assertTrue(anchorManager.loadAnchors().isSuccess)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Loaded correct Anchors from file`() {
|
||||
assertEquals(2, anchorManager.allAnchors.size)
|
||||
|
||||
val a1 = anchorManager.getAnchor("a1").orNull
|
||||
assertNotNull(a1)
|
||||
assertLocationEquals(UnloadedWorldLocation("w1", 0.5, 70.0, 0.5, -68.25f, 10.35f), a1.location)
|
||||
|
||||
val a2 = anchorManager.getAnchor("a2").orNull
|
||||
assertNotNull(a2)
|
||||
assertLocationEquals(UnloadedWorldLocation("w2", 3.3, 9.9, 6.6, -1.1f, 2.0f), a2.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Set new location for existing anchor`() {
|
||||
val a1 = anchorManager.getAnchor("a1").orNull
|
||||
assertNotNull(a1)
|
||||
val newLocation = UnloadedWorldLocation("w1", 1.0, 1.0, 1.0, 1.0f, 1.0f)
|
||||
anchorManager.setAnchor("a1", newLocation)
|
||||
assertLocationEquals(newLocation, a1.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create new anchor`() {
|
||||
val newLocation = UnloadedWorldLocation("w3", 3.0, 3.0, 3.0, -3.0f, 3.0f)
|
||||
anchorManager.setAnchor("a3", newLocation)
|
||||
assertLocationEquals(newLocation, anchorManager.getAnchor("a3").orNull?.location)
|
||||
|
||||
assertConfigEquals("/anchors/anchors_saved.yml", "anchors.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Delete anchor`() {
|
||||
val a1 = anchorManager.getAnchor("a1").orNull
|
||||
assertNotNull(a1)
|
||||
anchorManager.deleteAnchor(a1)
|
||||
assertNull(anchorManager.getAnchor("a1").orNull)
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.api
|
||||
|
||||
import org.mvplugins.multiverse.core.MultiverseCoreApi
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
class MultiverseCoreApiTest : TestWithMockBukkit() {
|
||||
|
||||
@Test
|
||||
fun `MultiverseCoreApi is available`() {
|
||||
val api = assertNotNull(MultiverseCoreApi.get())
|
||||
assertNotNull(api.blockSafety)
|
||||
assertNotNull(api.destinationsProvider)
|
||||
assertNotNull(api.generatorProvider)
|
||||
assertNotNull(api.locationManipulation)
|
||||
assertNotNull(api.coreConfig)
|
||||
assertNotNull(api.safetyTeleporter)
|
||||
assertNotNull(api.worldManager)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Get MultiverseCoreApi from bukkit service`() {
|
||||
val registeredService = server.servicesManager.getRegistration(MultiverseCoreApi::class.java)
|
||||
val api = assertNotNull(registeredService?.provider)
|
||||
testApiAccess(api)
|
||||
}
|
||||
|
||||
private fun testApiAccess(api: MultiverseCoreApi?) {
|
||||
assertNotNull(api?.anchorManager)
|
||||
assertNotNull(api?.blockSafety)
|
||||
assertNotNull(api?.destinationsProvider)
|
||||
assertNotNull(api?.mvEconomist)
|
||||
assertNotNull(api?.generatorProvider)
|
||||
assertNotNull(api?.locationManipulation)
|
||||
assertNotNull(api?.coreConfig)
|
||||
assertNotNull(api?.safetyTeleporter)
|
||||
assertNotNull(api?.worldManager)
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.command
|
||||
|
||||
import com.natpryce.hamkrest.assertion.assertThat
|
||||
import com.natpryce.hamkrest.containsSubstring
|
||||
import com.natpryce.hamkrest.endsWith
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.mockbukkit.mockbukkit.entity.PlayerMock
|
||||
import org.mockito.kotlin.argumentCaptor
|
||||
import org.mockito.kotlin.spy
|
||||
import org.mockito.kotlin.verify
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.locale.MVCorei18n
|
||||
import org.mvplugins.multiverse.core.locale.PluginLocales
|
||||
import org.mvplugins.multiverse.core.locale.message.Message
|
||||
import org.mvplugins.multiverse.core.locale.message.MessageReplacement.replace
|
||||
import java.util.Locale
|
||||
import kotlin.test.*
|
||||
|
||||
class LocalizationTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var locales: PluginLocales
|
||||
private lateinit var commandManager: MVCommandManager
|
||||
|
||||
@BeforeTest
|
||||
fun setUpLocale() {
|
||||
commandManager = assertNotNull(serviceLocator.getActiveService(MVCommandManager::class.java))
|
||||
locales = commandManager.locales
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("Given a Message with only a non-localized message")
|
||||
inner class BasicMessage {
|
||||
|
||||
private val messageString = "This is a test message"
|
||||
private val message = Message.of(messageString)
|
||||
|
||||
@Test
|
||||
fun `The raw message should be the same as the original`() {
|
||||
assertEquals(messageString, message.raw())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message should be the same as the original`() {
|
||||
assertEquals(messageString, message.formatted())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should be the same as the original`() {
|
||||
assertEquals(messageString, message.formatted(locales))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales for a CommandIssuer should be the same as the original`() {
|
||||
assertEquals(messageString, message.formatted(locales, commandManager.consoleCommandIssuer))
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("And a command sender is provided")
|
||||
inner class WithCommandSender {
|
||||
|
||||
private lateinit var sender: CommandSender
|
||||
private lateinit var issuer: MVCommandIssuer
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
sender = spy(Bukkit.getConsoleSender())
|
||||
issuer = commandManager.getCommandIssuer(sender)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Sending the issuer the message should send the formatted message to the sender`() {
|
||||
issuer.sendInfo(message);
|
||||
|
||||
verify(sender).sendMessage("§9§9$messageString")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("Given a Message with a non-localized message and one replacement")
|
||||
inner class MessageWithOneReplacement {
|
||||
|
||||
private val replacementKey = "{count}"
|
||||
private val messageString = "This is a test message with $replacementKey replacement"
|
||||
private val replacedMessageString = messageString.replace(replacementKey, "one")
|
||||
|
||||
private val message = Message.of(messageString, replace(replacementKey).with("one"))
|
||||
|
||||
@Test
|
||||
fun `The raw message should be the same as the original`() {
|
||||
assertEquals(messageString, message.raw())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message should be the replaced message string`() {
|
||||
assertEquals(replacedMessageString, message.formatted())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should be the replaced message string`() {
|
||||
assertEquals(replacedMessageString, message.formatted(locales))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales for a CommandIssuer should be the replaced message string`() {
|
||||
assertEquals(replacedMessageString, message.formatted(locales, commandManager.consoleCommandIssuer))
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("And a command sender is provided")
|
||||
inner class WithCommandSender {
|
||||
|
||||
private lateinit var sender: CommandSender
|
||||
private lateinit var issuer: MVCommandIssuer
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
sender = spy(Bukkit.getConsoleSender())
|
||||
issuer = commandManager.getCommandIssuer(sender)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Sending the issuer the message should send the formatted message to the sender`() {
|
||||
issuer.sendInfo(message);
|
||||
|
||||
verify(sender).sendMessage("§9§9$replacedMessageString")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("Given a Message with a non-localized message and two replacements")
|
||||
inner class MessageWithTwoReplacements {
|
||||
|
||||
private val replacementKey1 = "{thing1}"
|
||||
private val replacementKey2 = "{thing2}"
|
||||
private val messageString = "$replacementKey1 $replacementKey2"
|
||||
private val replacedMessageString = messageString
|
||||
.replace(replacementKey1, "one")
|
||||
.replace(replacementKey2, "two")
|
||||
|
||||
private val message = Message.of(
|
||||
messageString,
|
||||
replace(replacementKey1).with("one"),
|
||||
replace(replacementKey2).with("two"),
|
||||
)
|
||||
|
||||
@Test
|
||||
fun `The raw message should be the same as the original`() {
|
||||
assertEquals(messageString, message.raw())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message should be the replaced message string`() {
|
||||
assertEquals(replacedMessageString, message.formatted())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should be the replaced message string`() {
|
||||
assertEquals(replacedMessageString, message.formatted(locales))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales for a CommandIssuer should be the replaced message string`() {
|
||||
assertEquals(replacedMessageString, message.formatted(locales, commandManager.consoleCommandIssuer))
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("And a command sender is provided")
|
||||
inner class WithCommandSender {
|
||||
|
||||
private lateinit var sender: CommandSender
|
||||
private lateinit var issuer: MVCommandIssuer
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
sender = spy(Bukkit.getConsoleSender())
|
||||
issuer = commandManager.getCommandIssuer(sender)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Sending the issuer the message should send the formatted message to the sender`() {
|
||||
issuer.sendInfo(message);
|
||||
|
||||
verify(sender).sendMessage("§9§9$replacedMessageString")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("Given a Message with a localized message with one replacement")
|
||||
inner class LocalizedMessage {
|
||||
|
||||
private val replacementKey = "{world}"
|
||||
private val replacementValue = "World"
|
||||
private val messageString = "Hello $replacementKey!"
|
||||
private val replacedMessageString = messageString.replace(replacementKey, replacementValue)
|
||||
|
||||
private val message = MVCorei18n.CLONE_SUCCESS
|
||||
.bundle(messageString, replace(replacementKey).with(replacementValue))
|
||||
|
||||
@Test
|
||||
fun `The raw message should be the same as the original`() {
|
||||
assertEquals(messageString, message.raw())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message should be the replaced original string`() {
|
||||
assertEquals(replacedMessageString, message.formatted())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should be different from the replaced original string`() {
|
||||
assertNotEquals(replacedMessageString, message.formatted(locales))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should have performed replacement`() {
|
||||
assertThat(message.formatted(locales), !containsSubstring(replacementKey))
|
||||
assertThat(message.formatted(locales), containsSubstring(replacementValue))
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("And a command sender is provided")
|
||||
inner class WithCommandSender {
|
||||
|
||||
private lateinit var sender: CommandSender
|
||||
private lateinit var issuer: MVCommandIssuer
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
sender = spy(Bukkit.getConsoleSender())
|
||||
issuer = commandManager.getCommandIssuer(sender)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Sending the issuer the message should send the formatted message to the sender`() {
|
||||
issuer.sendInfo(message);
|
||||
|
||||
val sentMessage = argumentCaptor<String> {
|
||||
verify(sender).sendMessage(capture())
|
||||
}.firstValue
|
||||
|
||||
assertNotEquals(replacedMessageString, sentMessage)
|
||||
assertThat(sentMessage, !containsSubstring(replacementKey))
|
||||
assertThat(sentMessage, containsSubstring(replacementValue))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
inner class WithMessagesAsReplacement {
|
||||
private val replacementKey = "{world}"
|
||||
private val replacementValue = Message.of(
|
||||
MVCorei18n.GENERIC_SUCCESS, "success")
|
||||
private val messageString = "Hello $replacementKey!"
|
||||
private val replacedMessageString = "Hello success!"
|
||||
private val replacedMessageStringLocale = "World cloned to 'Success!'!"
|
||||
|
||||
private val message = MVCorei18n.CLONE_SUCCESS
|
||||
.bundle(messageString, replace(replacementKey).with(replacementValue))
|
||||
|
||||
@Test
|
||||
fun `The raw message should be the same as the original`() {
|
||||
assertEquals(messageString, message.raw())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message should be the replaced original string`() {
|
||||
assertEquals(replacedMessageString, message.formatted())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should be different from the replaced original string`() {
|
||||
assertThat(message.formatted(locales), endsWith(replacedMessageStringLocale))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `The formatted message with PluginLocales should have performed replacement`() {
|
||||
assertThat(message.formatted(locales), !containsSubstring(replacementKey))
|
||||
assertThat(message.formatted(locales), containsSubstring("Success!"))
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("And a command sender is provided")
|
||||
inner class WithCommandSender {
|
||||
|
||||
private lateinit var sender: CommandSender
|
||||
private lateinit var issuer: MVCommandIssuer
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
sender = spy(Bukkit.getConsoleSender())
|
||||
issuer = commandManager.getCommandIssuer(sender)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Sending the issuer the message should send the formatted message to the sender`() {
|
||||
issuer.sendInfo(message);
|
||||
|
||||
val sentMessage = argumentCaptor<String> {
|
||||
verify(sender).sendMessage(capture())
|
||||
}.firstValue
|
||||
|
||||
assertNotEquals(replacedMessageString, sentMessage)
|
||||
assertThat(sentMessage, !containsSubstring(replacementKey))
|
||||
assertThat(sentMessage, containsSubstring(replacedMessageStringLocale))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
inner class LocaleConfiguration {
|
||||
private lateinit var config: CoreConfig
|
||||
private lateinit var player: PlayerMock
|
||||
private lateinit var issuer: MVCommandIssuer
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
config = assertNotNull(serviceLocator.getActiveService(CoreConfig::class.java))
|
||||
player = server.addPlayer("benji_0224")
|
||||
issuer = commandManager.getCommandIssuer(player)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Change default locale to chinese without per player locale should get chinese message`() {
|
||||
config.perPlayerLocale = false
|
||||
config.defaultLocale = Locale.CHINESE
|
||||
assertEquals("成功!", Message.of(
|
||||
MVCorei18n.GENERIC_SUCCESS, "").formatted(locales, issuer))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Change default locale to chinese with per player locale should get default english message`() {
|
||||
config.perPlayerLocale = true
|
||||
config.defaultLocale = Locale.CHINESE
|
||||
assertEquals("Success!", Message.of(
|
||||
MVCorei18n.GENERIC_SUCCESS, "").formatted(locales, issuer))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `PerPlayerLocale enabled - Player with chinese locale should get chinese message`() {
|
||||
config.perPlayerLocale = true
|
||||
player.setLocale(Locale.CHINESE)
|
||||
assertEquals("成功!", Message.of(
|
||||
MVCorei18n.GENERIC_SUCCESS, "").formatted(locales, issuer))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `PerPlayerLocale disabled - Player with chinese locale should get default english message`() {
|
||||
config.perPlayerLocale = false
|
||||
player.setLocale(Locale.CHINESE)
|
||||
assertEquals("Success!", Message.of(
|
||||
MVCorei18n.GENERIC_SUCCESS, "").formatted(locales, issuer))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.permissions.PermissionAttachment
|
||||
import org.mockbukkit.mockbukkit.command.ConsoleCommandSenderMock
|
||||
import org.mockbukkit.mockbukkit.entity.PlayerMock
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.command.MVCommandManager
|
||||
import org.mvplugins.multiverse.core.locale.PluginLocales
|
||||
import org.mvplugins.multiverse.core.locale.message.Message
|
||||
import org.mvplugins.multiverse.core.utils.text.ChatTextFormatter
|
||||
import org.mvplugins.multiverse.core.world.WorldManager
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
abstract class AbstractCommandTest : TestWithMockBukkit() {
|
||||
|
||||
protected lateinit var worldManager: WorldManager
|
||||
protected lateinit var player: PlayerMock
|
||||
protected lateinit var console: ConsoleCommandSenderMock
|
||||
|
||||
private lateinit var locales : PluginLocales
|
||||
private lateinit var attachment : PermissionAttachment
|
||||
|
||||
@BeforeTest
|
||||
fun setUpCommand() {
|
||||
worldManager = serviceLocator.getActiveService(WorldManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldManager is not available as a service") }
|
||||
assertTrue(worldManager.createWorld(CreateWorldOptions.worldName("world")).isSuccess)
|
||||
|
||||
val commandManager = serviceLocator.getActiveService(MVCommandManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("MVCommandManager is not available as a service") }
|
||||
locales = commandManager.locales
|
||||
|
||||
console = server.consoleSender
|
||||
player = server.addPlayer("benwoo1110");
|
||||
assertEquals(player, server.getPlayer("benwoo1110"))
|
||||
attachment = player.addAttachment(multiverseCore)
|
||||
assertNotNull(attachment)
|
||||
}
|
||||
|
||||
fun addPermission(permission: String) {
|
||||
attachment.setPermission(permission, true)
|
||||
}
|
||||
|
||||
fun assertCommandOutput(message : Message) {
|
||||
assertEquals(
|
||||
ChatTextFormatter.removeColor(message.formatted(locales)),
|
||||
ChatTextFormatter.removeColor(player.nextMessage())
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import co.aikar.commands.MessageKeys
|
||||
import org.bukkit.Bukkit
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.locale.MVCorei18n
|
||||
import org.mvplugins.multiverse.core.locale.message.Message
|
||||
import org.mvplugins.multiverse.core.locale.message.MessageReplacement.replace
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class ConfigCommandTest : AbstractCommandTest() {
|
||||
|
||||
@Test
|
||||
fun `Modify config global-debug`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv config global-debug 2"))
|
||||
val coreConfig = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
assertEquals(2, coreConfig.globalDebug)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Modify config global-debug player no permission`() {
|
||||
assertTrue(player.performCommand("mv config global-debug 2"))
|
||||
assertCommandOutput(Message.of(MessageKeys.PERMISSION_DENIED, ""))
|
||||
|
||||
val coreConfig = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
assertEquals(0, coreConfig.globalDebug)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Modify non-existing config property`() {
|
||||
addPermission("multiverse.core.config")
|
||||
assertTrue(player.performCommand("mv config invalid-property test"))
|
||||
player.nextMessage() // ignore the first line
|
||||
assertCommandOutput(
|
||||
Message.of(
|
||||
MVCorei18n.CONFIG_NODE_NOTFOUND,
|
||||
"",
|
||||
replace("{node}").with("invalid-property")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Modify config global-debug invalid type`() {
|
||||
addPermission("multiverse.core.config")
|
||||
assertTrue(player.performCommand("mv config global-debug what"))
|
||||
player.nextMessage() // ignore the first line
|
||||
assertCommandOutput(Message.of("Unable to convert 'what' to number. (integer)"))
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.World
|
||||
import org.bukkit.WorldType
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class CreateCommandTest : AbstractCommandTest() {
|
||||
|
||||
@Test
|
||||
fun `Create nether world with default options`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv create world1_nether nether"))
|
||||
val world = worldManager.getLoadedWorld("world1_nether")
|
||||
assertTrue(world.isDefined)
|
||||
assertEquals(World.Environment.NETHER, world.get().environment)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create normal world with specific seed and flat world type without structures`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv create world1 normal --seed 1234 --world-type flat --no-structures"))
|
||||
val world = worldManager.getLoadedWorld("world1")
|
||||
assertTrue(world.isDefined)
|
||||
assertEquals(1234L, world.get().seed)
|
||||
assertEquals(WorldType.FLAT, world.get().worldType.get())
|
||||
assertFalse(world.get().canGenerateStructures().get())
|
||||
}
|
||||
|
||||
//todo: Fix mockbukkit getBiomeProvider then added test on single biome world creation
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.mvplugins.multiverse.core.command.queue.ConfirmMode
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.UnloadWorldOptions
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DeleteCommandTest : AbstractCommandTest() {
|
||||
|
||||
private lateinit var testWorld : LoadedMultiverseWorld
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
// Disable confirmation to make tests easier
|
||||
val config = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
config.confirmMode = ConfirmMode.DISABLE
|
||||
|
||||
testWorld = worldManager.createWorld(CreateWorldOptions.worldName("test")).get()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Delete loaded world`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv delete test"))
|
||||
assertFalse(worldManager.getWorld("test").isDefined)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Delete unloaded world`() {
|
||||
worldManager.unloadWorld(UnloadWorldOptions.world(testWorld))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv delete test"))
|
||||
assertFalse(worldManager.getWorld("test").isDefined)
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.mvplugins.multiverse.core.command.queue.ConfirmMode
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class ModifyCommandTest : AbstractCommandTest() {
|
||||
|
||||
private lateinit var testWorld : LoadedMultiverseWorld
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
// Disable confirmation to make tests easier
|
||||
val config = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
config.confirmMode = ConfirmMode.DISABLE
|
||||
|
||||
testWorld = worldManager.createWorld(CreateWorldOptions.worldName("test")).get()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Modify alias name with space`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv modify test set alias \"Test World\""))
|
||||
assertEquals("Test World", testWorld.alias)
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.GameRule
|
||||
import org.mvplugins.multiverse.core.command.queue.ConfirmMode
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import kotlin.test.*
|
||||
|
||||
class RegenCommandTest : AbstractCommandTest() {
|
||||
|
||||
private lateinit var testWorld : LoadedMultiverseWorld
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
// Disable confirmation to make tests easier
|
||||
val config = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
assertTrue(config.setConfirmMode(ConfirmMode.DISABLE).isSuccess)
|
||||
|
||||
testWorld = worldManager.createWorld(CreateWorldOptions.worldName("test")).get()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world`() {
|
||||
val previousUID = testWorld.uid
|
||||
val previousSeed = testWorld.seed
|
||||
testWorld.scale = 69.5
|
||||
testWorld.bukkitWorld.map {
|
||||
it.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false)
|
||||
}
|
||||
testWorld.bukkitWorld.map {
|
||||
it.worldBorder.size = 123.4
|
||||
}
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv regen test"))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv confirm"))
|
||||
|
||||
val newWorld = worldManager.getLoadedWorld("test").orNull
|
||||
|
||||
assertNotNull(newWorld)
|
||||
assertNotEquals(previousUID, newWorld.uid)
|
||||
assertEquals(previousSeed, newWorld.seed)
|
||||
assertEquals(69.5, newWorld.scale)
|
||||
assertEquals(false, newWorld.bukkitWorld.map { it.getGameRuleValue(GameRule.DO_DAYLIGHT_CYCLE) }.orNull)
|
||||
assertEquals(123.4, newWorld.bukkitWorld.map { it.worldBorder.size }.orNull)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world with specific seed`() {
|
||||
val previousUID = testWorld.uid
|
||||
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv regen test --seed 456"))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv confirm"))
|
||||
|
||||
val newWorld = worldManager.getLoadedWorld("test").orNull
|
||||
|
||||
assertNotNull(newWorld)
|
||||
assertNotEquals(previousUID, newWorld.uid)
|
||||
assertEquals(456, newWorld.seed)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world with random seed`() {
|
||||
val previousUID = testWorld.uid
|
||||
val previousSeed = testWorld.seed
|
||||
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv regen test --seed"))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv confirm"))
|
||||
|
||||
val newWorld = worldManager.getLoadedWorld("test").orNull
|
||||
|
||||
assertNotNull(newWorld)
|
||||
assertNotEquals(previousUID, newWorld.uid)
|
||||
assertNotEquals(previousSeed, newWorld.seed)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world and reset world config`() {
|
||||
val previousUID = testWorld.uid
|
||||
testWorld.scale = 69.5
|
||||
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv regen test --reset-world-config"))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv confirm"))
|
||||
|
||||
val newWorld = worldManager.getLoadedWorld("test").orNull
|
||||
|
||||
assertNotNull(newWorld)
|
||||
assertNotEquals(previousUID, newWorld.uid)
|
||||
assertEquals(1.0, newWorld.scale)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world and reset gamerules`() {
|
||||
val previousUID = testWorld.uid
|
||||
testWorld.bukkitWorld.map {
|
||||
it.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false)
|
||||
}
|
||||
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv regen test --reset-gamerules"))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv confirm"))
|
||||
|
||||
val newWorld = worldManager.getLoadedWorld("test").orNull
|
||||
|
||||
assertNotNull(newWorld)
|
||||
assertNotEquals(previousUID, newWorld.uid)
|
||||
assertEquals(true, newWorld.bukkitWorld.map { it.getGameRuleValue(GameRule.DO_DAYLIGHT_CYCLE) }.orNull)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world and reset world border`() {
|
||||
val previousUID = testWorld.uid
|
||||
testWorld.bukkitWorld.map {
|
||||
it.worldBorder.size = 123.4
|
||||
}
|
||||
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv regen test --reset-world-border"))
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv confirm"))
|
||||
|
||||
val newWorld = worldManager.getLoadedWorld("test").orNull
|
||||
|
||||
assertNotNull(newWorld)
|
||||
assertNotEquals(previousUID, newWorld.uid)
|
||||
assertEquals(6.0E7, newWorld.bukkitWorld.map { it.worldBorder.size }.orNull)
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.Location
|
||||
import org.mvplugins.multiverse.core.world.location.SpawnLocation
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class SpawnCommandTest : AbstractCommandTest() {
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
server.addPlayer("Player1")
|
||||
server.addPlayer("Player2")
|
||||
server.addPlayer("Player3")
|
||||
assertTrue(worldManager.createWorld(CreateWorldOptions.worldName("otherworld")).isSuccess)
|
||||
server.getWorld("otherworld")?.spawnLocation?.let { Bukkit.getPlayer("Player1")?.teleport(it) }
|
||||
worldManager.getLoadedWorld("world").get().setSpawnLocation(SpawnLocation(20.0, 20.0, 20.0))
|
||||
worldManager.getLoadedWorld("otherworld").get().setSpawnLocation(SpawnLocation(20.0, 20.0, 20.0))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Teleport player to spawn location`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv spawn Player1 --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Teleport multiple players to spawn location`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv spawn Player1,Player2,Player3 --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player3")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `No permission to teleport to spawn`() {
|
||||
assertTrue(player.performCommand("mv spawn"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(Location(server.getWorld("world"), 0.0, 5.0, 0.0), player.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Self permission to teleport to spawn`() {
|
||||
addPermission("multiverse.core.spawn.self.world")
|
||||
assertTrue(player.performCommand("mv spawn --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, player.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Other permission to teleport to spawn`() {
|
||||
addPermission("multiverse.core.spawn.other.world")
|
||||
assertTrue(player.performCommand("mv spawn Player1,Player2 --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(Location(server.getWorld("otherworld"), 0.0, 5.0, 0.0), server.getPlayer("Player1")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
}
|
||||
@Test
|
||||
fun `Teleport others to spawn but not self`() {
|
||||
addPermission("multiverse.core.spawn.other.otherworld")
|
||||
assertTrue(player.performCommand("mv spawn benwoo1110,Player1 --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(Location(server.getWorld("world"), 0.0, 5.0, 0.0), server.getPlayer("benwoo1110")?.location)
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class TeleportCommandTest : AbstractCommandTest() {
|
||||
|
||||
private lateinit var config : CoreConfig
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
config = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
|
||||
server.addPlayer("Player1")
|
||||
server.addPlayer("Player2")
|
||||
server.addPlayer("Player3")
|
||||
assertTrue(worldManager.createWorld(CreateWorldOptions.worldName("otherworld")).isSuccess)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Teleport a player to other world`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv tp Player1 otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Teleport multiple players to other world`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv tp Player1,Player2 otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Teleport multiple players to invalid world`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv tp Player1,Player2 invalidworld"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player no permission to teleport`() {
|
||||
assertTrue(player.performCommand("mv tp otherworld"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player permission to teleport self`() {
|
||||
addPermission("multiverse.teleport.self.w.otherworld")
|
||||
|
||||
assertTrue(player.performCommand("mv tp otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, player.location)
|
||||
|
||||
assertTrue(player.performCommand("mv tp Player1 world --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
|
||||
assertTrue(player.performCommand("mv tp Player2,Player3 world --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player3")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player permission to teleport others`() {
|
||||
addPermission("multiverse.teleport.other.w.otherworld")
|
||||
|
||||
assertTrue(player.performCommand("mv tp Player1 otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
|
||||
assertTrue(player.performCommand("mv tp Player2,Player3 otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player3")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player permission to teleport others cannot teleport self`() {
|
||||
addPermission("multiverse.teleport.other.w.otherworld")
|
||||
|
||||
assertTrue(player.performCommand("mv tp otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, player.location)
|
||||
|
||||
assertTrue(player.performCommand("mv tp benwoo1110,Player1,Player2 world --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("benwoo1110")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player permission to teleport self without finer permission`() {
|
||||
config.setUseFinerTeleportPermissions(false)
|
||||
addPermission("multiverse.teleport.self.w")
|
||||
|
||||
assertTrue(player.performCommand("mv tp otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, player.location)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player permission to teleport others without finer permission`() {
|
||||
config.setUseFinerTeleportPermissions(false)
|
||||
addPermission("multiverse.teleport.other.w")
|
||||
|
||||
assertTrue(player.performCommand("mv tp Player1,Player2 otherworld --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player1")?.location)
|
||||
assertLocationEquals(server.getWorld("otherworld")?.spawnLocation, server.getPlayer("Player2")?.location)
|
||||
|
||||
assertTrue(player.performCommand("mv tp benwoo1110,Player3 world --unsafe"))
|
||||
Thread.sleep(10) // wait for the player to teleport asynchronously
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("benwoo1110")?.location)
|
||||
assertLocationEquals(server.getWorld("world")?.spawnLocation, server.getPlayer("Player3")?.location)
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.commands
|
||||
|
||||
import co.aikar.commands.MessageKeys
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.ChatColor
|
||||
import org.mvplugins.multiverse.core.locale.MVCorei18n
|
||||
import org.mvplugins.multiverse.core.locale.message.Message
|
||||
import org.mvplugins.multiverse.core.locale.message.MessageReplacement.replace
|
||||
import org.mvplugins.multiverse.core.utils.text.ChatTextFormatter
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class VersionCommandTest : AbstractCommandTest() {
|
||||
|
||||
@Test
|
||||
fun `Run version command as console`() {
|
||||
assertTrue(Bukkit.dispatchCommand(console, "mv version"))
|
||||
val output = ChatTextFormatter.removeColor(console.nextMessage())
|
||||
assertEquals("Multiverse Core Version v" + multiverseCore.getDescription().getVersion(), output)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Run version command as player`() {
|
||||
addPermission("multiverse.core.version")
|
||||
assertTrue(player.performCommand("mv version"))
|
||||
assertCommandOutput(
|
||||
Message.of(
|
||||
MVCorei18n.VERSION_MV,
|
||||
"",
|
||||
replace("{version}").with(multiverseCore.getDescription().getVersion())))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Run version command as player - no permission`() {
|
||||
assertTrue(player.performCommand("mv version"))
|
||||
assertCommandOutput(Message.of(MessageKeys.PERMISSION_DENIED, ""))
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.config
|
||||
|
||||
import org.bukkit.Location
|
||||
import org.mockbukkit.mockbukkit.entity.PlayerMock
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter
|
||||
import org.mvplugins.multiverse.core.world.WorldManager
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import java.lang.AssertionError
|
||||
import kotlin.test.*
|
||||
|
||||
class ConfigTeleportInterceptTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var config: CoreConfig
|
||||
private lateinit var safetyTeleporter: AsyncSafetyTeleporter
|
||||
private lateinit var player: PlayerMock
|
||||
private lateinit var location: Location
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
config = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
|
||||
safetyTeleporter = serviceLocator.getActiveService(AsyncSafetyTeleporter::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("AsyncSafetyTeleporter is not available as a service") }
|
||||
|
||||
val worldManager = serviceLocator.getActiveService(WorldManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldManager is not available as a service") }
|
||||
|
||||
player = server.addPlayer()
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("world2")).get()
|
||||
location = Location(server.getWorld("world2"), 0.0, 5.0, 0.0)
|
||||
config.enforceAccess = true
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Generic teleport with teleport intercept enabled`() {
|
||||
config.teleportIntercept = true
|
||||
assertFalse(player.teleport(location))
|
||||
assertEquals("world", player.world.name)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Generic teleport with teleport intercept disabled - no access checking`() {
|
||||
config.teleportIntercept = false
|
||||
assertTrue(player.teleport(location))
|
||||
assertEquals("world2", player.world.name)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Multiverse API teleport with teleport intercept disabled`() {
|
||||
config.teleportIntercept = false
|
||||
safetyTeleporter.to(location).teleport(player).toAttempt()
|
||||
.onSuccess (Runnable { throw AssertionError("Teleport should have failed") })
|
||||
.onFailure(Runnable { assertEquals("world", player.world.name) })
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.config
|
||||
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.command.queue.ConfirmMode
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.test.*
|
||||
|
||||
class ConfigTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var config : CoreConfig
|
||||
private lateinit var configFile : File
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
configFile = File(Path.of(multiverseCore.dataFolder.absolutePath, "config.yml").absolutePathString())
|
||||
if (configFile.exists()) configFile.delete()
|
||||
|
||||
config = serviceLocator.getActiveService(CoreConfig::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("CoreConfig is not available as a service") }
|
||||
|
||||
assertTrue(config.load().isSuccess)
|
||||
assertTrue(config.save().isSuccess)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Config is loaded`() {
|
||||
assertTrue(config.isLoaded)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Config is fresh`() {
|
||||
assertConfigEquals("/configs/fresh_config.yml", "config.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Old config is migrated`() {
|
||||
val oldConfig = getResourceAsText("/configs/old_config.yml")
|
||||
assertNotNull(oldConfig)
|
||||
multiverseCore.dataFolder.toPath().resolve("config.yml").toFile().writeText(oldConfig)
|
||||
assertTrue(config.load().isSuccess)
|
||||
assertTrue(config.save().isSuccess)
|
||||
|
||||
assertEquals(true, config.enforceAccess)
|
||||
assertEquals(false, config.isEnablePrefixChat)
|
||||
assertEquals("[%world%]>>%chat%", config.prefixChatFormat)
|
||||
assertEquals(false, config.teleportIntercept)
|
||||
assertEquals(true, config.firstSpawnOverride)
|
||||
assertEquals(2, config.globalDebug)
|
||||
assertEquals(false, config.silentStart)
|
||||
assertEquals("world", config.firstSpawnLocation)
|
||||
assertEquals(false, config.isUsingCustomPortalSearch)
|
||||
assertEquals(128, config.customPortalSearchRadius)
|
||||
assertEquals(true, config.isAutoPurgeEntities)
|
||||
assertEquals(false, config.isShowingDonateMessage)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Getting existing config property with getProperty returns expected value`() {
|
||||
assertEquals(false, config.stringPropertyHandle.getProperty("enforce-access").get())
|
||||
assertEquals("", config.stringPropertyHandle.getProperty("first-spawn-location").get())
|
||||
assertEquals(ConfirmMode.ENABLE, config.stringPropertyHandle.getProperty("confirm-mode").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Getting non-existing config property with getProperty returns null`() {
|
||||
assertTrue(config.stringPropertyHandle.getProperty("invalid-property").isFailure)
|
||||
assertTrue(config.stringPropertyHandle.getProperty("version").isFailure)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Getting existing config property by getter returns expected value`() {
|
||||
assertEquals(false, config.enforceAccess)
|
||||
assertEquals("", config.firstSpawnLocation)
|
||||
assertEquals(ConfirmMode.ENABLE, config.confirmMode)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating an existing config property with setProperty reflects the changes in getProperty`() {
|
||||
assertTrue(config.stringPropertyHandle.setProperty("enforce-access", true).isSuccess)
|
||||
assertEquals(true, config.stringPropertyHandle.getProperty("enforce-access").get())
|
||||
|
||||
assertTrue(config.stringPropertyHandle.setProperty("chat-prefix-format", "%world% %chat%").isSuccess)
|
||||
assertEquals("%world% %chat%", config.stringPropertyHandle.getProperty("chat-prefix-format").get())
|
||||
|
||||
assertTrue(config.stringPropertyHandle.setProperty("global-debug", 1).isSuccess)
|
||||
assertEquals(1, config.stringPropertyHandle.getProperty("global-debug").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating an existing config property with setPropertyString reflects the changes in getProperty`() {
|
||||
assertTrue(config.stringPropertyHandle.setPropertyString("enforce-access", "true").isSuccess)
|
||||
assertEquals(true, config.stringPropertyHandle.getProperty("enforce-access").get())
|
||||
|
||||
assertTrue(config.stringPropertyHandle.setPropertyString("chat-prefix-format", "%world% %chat%").isSuccess)
|
||||
assertEquals("%world% %chat%", config.stringPropertyHandle.getProperty("chat-prefix-format").get())
|
||||
|
||||
assertTrue(config.stringPropertyHandle.setPropertyString("global-debug", "1").isSuccess)
|
||||
assertEquals(1, config.stringPropertyHandle.getProperty("global-debug").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating a non-existing property with setProperty returns false`() {
|
||||
assertTrue(config.stringPropertyHandle.setProperty("invalid-property", false).isFailure)
|
||||
assertTrue(config.stringPropertyHandle.setProperty("version", 1.1).isFailure)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Broken config should regen fresh config`() {
|
||||
val brokenConfigData = getResourceAsText("/configs/broken_config.yml")
|
||||
assertNotNull(brokenConfigData)
|
||||
configFile.writeText(brokenConfigData)
|
||||
assertTrue(config.load().isSuccess)
|
||||
assertTrue(config.save().isSuccess)
|
||||
val brokenConfigFile = configFile.parentFile.listFiles({ _, fileName -> fileName.startsWith("config.yml.broken") })
|
||||
assertNotNull(brokenConfigFile)
|
||||
assertEquals(1, brokenConfigFile.size)
|
||||
assertConfigEquals("/configs/fresh_config.yml", "config.yml")
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.destination
|
||||
|
||||
import org.bukkit.Location
|
||||
import org.mockbukkit.mockbukkit.entity.PlayerMock
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.destination.core.*
|
||||
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld
|
||||
import org.mvplugins.multiverse.core.world.WorldManager
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DestinationTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var worldManager: WorldManager
|
||||
private lateinit var destinationsProvider: DestinationsProvider
|
||||
private lateinit var world: LoadedMultiverseWorld
|
||||
private lateinit var player: PlayerMock
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
worldManager = serviceLocator.getActiveService(WorldManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldManager is not available as a service") }
|
||||
destinationsProvider = serviceLocator.getActiveService(DestinationsProvider::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("DestinationsProvider is not available as a service") }
|
||||
|
||||
world = worldManager.createWorld(CreateWorldOptions.worldName("world")).get()
|
||||
player = server.addPlayer("benji_0224")
|
||||
player.bedSpawnLocation = Location(world.bukkitWorld.orNull, 5.0, 10.0, 5.0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Bed destination instance`() {
|
||||
assertTrue(destinationsProvider.getDestinationById("b") is BedDestination)
|
||||
val destination = destinationsProvider.parseDestination("b:benji_0224").get()
|
||||
assertTrue(destination is BedDestinationInstance)
|
||||
assertEquals(player.bedSpawnLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("b:benji_0224", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Bed destination instance own player`() {
|
||||
val destination = destinationsProvider.parseDestination("b:playerbed").orNull
|
||||
assertTrue(destination is BedDestinationInstance)
|
||||
assertEquals(player.bedSpawnLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("b:playerbed", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Cannon destination instance`() {
|
||||
assertTrue(destinationsProvider.getDestinationById("ca") is CannonDestination)
|
||||
val destination = destinationsProvider.parseDestination("ca:world:1.2,2,3:10.5:9.5:5").orNull
|
||||
assertTrue(destination is CannonDestinationInstance)
|
||||
val expectedLocation = Location(world.bukkitWorld.orNull, 1.2, 2.0, 3.0, 9.5F, 10.5F)
|
||||
assertLocationEquals(expectedLocation, destination.getLocation(player).orNull)
|
||||
// todo: assert the Vector
|
||||
assertEquals("ca:world:1.2,2.0,3.0:10.5:9.5:5.0", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Exact destination instance`() {
|
||||
assertTrue(destinationsProvider.getDestinationById("e") is ExactDestination)
|
||||
val destination = destinationsProvider.parseDestination("e:world:1.2,2,3:10.5:9.5").orNull
|
||||
assertTrue(destination is ExactDestinationInstance)
|
||||
val expectedLocation = Location(world.bukkitWorld.orNull, 1.2, 2.0, 3.0, 9.5F, 10.5F)
|
||||
assertLocationEquals(expectedLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("e:world:1.2,2.0,3.0:10.5:9.5", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Exact destination instance with relative position`() {
|
||||
val destination = destinationsProvider.parseDestination("e:world:~1.5,2,~-3:10.5:~9.5").orNull
|
||||
assertTrue(destination is ExactDestinationInstance)
|
||||
val expectedLocation = Location(
|
||||
world.bukkitWorld.orNull,
|
||||
player.location.x + 1.5,
|
||||
2.0,
|
||||
player.location.z - 3.0,
|
||||
player.location.yaw + 9.5F,
|
||||
10.5F
|
||||
)
|
||||
assertLocationEquals(expectedLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("e:world:~1.5,2.0,~-3.0:10.5:~9.5", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Exact destination instance from location`() {
|
||||
val exactDestination = serviceLocator.getActiveService(ExactDestination::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("ExactDestination is not available as a service") }
|
||||
|
||||
val location = Location(world.bukkitWorld.orNull, 1.2, 2.0, 3.0, 9.5F, 10.5F)
|
||||
val destination = exactDestination.fromLocation(location)
|
||||
assertEquals(location, destination.getLocation(player).orNull)
|
||||
assertEquals("e:world:1.2,2.0,3.0:10.5:9.5", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Player destination instance`() {
|
||||
assertTrue(destinationsProvider.getDestinationById("pl") is PlayerDestination)
|
||||
val destination = destinationsProvider.parseDestination("pl:benji_0224").orNull
|
||||
assertTrue(destination is PlayerDestinationInstance)
|
||||
assertEquals(player.location, destination.getLocation(player).orNull)
|
||||
assertEquals("pl:benji_0224", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `World destination instance`() {
|
||||
assertTrue(destinationsProvider.getDestinationById("w") is WorldDestination)
|
||||
val destination = destinationsProvider.parseDestination("w:world").orNull
|
||||
assertTrue(destination is WorldDestinationInstance)
|
||||
assertEquals(world.spawnLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("w:world", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `World destination instance without identifier`() {
|
||||
val destination = destinationsProvider.parseDestination("world").orNull
|
||||
assertTrue(destination is WorldDestinationInstance)
|
||||
assertEquals(world.spawnLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("w:world", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `World destination instance from alias name`() {
|
||||
world.setAlias("testalias")
|
||||
val destination = destinationsProvider.parseDestination("testalias").orNull
|
||||
assertTrue(destination is WorldDestinationInstance)
|
||||
assertEquals(world.spawnLocation, destination.getLocation(player).orNull)
|
||||
assertEquals("w:world", destination.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Invalid destination instance`() {
|
||||
assertTrue(destinationsProvider.parseDestination("").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("idk:world").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("a:invalid-anchor").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("b:invalid-bed").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("ca:invalid-cannon").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("e:world:1,2,x").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("e:world:1,2,3:").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("pl:invalid-player").isFailure)
|
||||
assertTrue(destinationsProvider.parseDestination("w:invalid-world").isFailure)
|
||||
// todo: should we make invalid yaw for WorldDestination fail?
|
||||
// assertTrue(destinationsProvider.parseDestination("w:world:f").isEmpty)
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.inject
|
||||
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.anchor.AnchorManager
|
||||
import org.mvplugins.multiverse.core.commands.CoreCommand
|
||||
import org.mvplugins.multiverse.core.command.MVCommandManager
|
||||
import org.mvplugins.multiverse.core.config.CoreConfig
|
||||
import org.mvplugins.multiverse.core.destination.Destination
|
||||
import org.mvplugins.multiverse.core.economy.MVEconomist
|
||||
import org.mvplugins.multiverse.core.listeners.CoreListener
|
||||
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter
|
||||
import org.mvplugins.multiverse.core.teleportation.BlockSafety
|
||||
import org.mvplugins.multiverse.core.teleportation.LocationManipulation
|
||||
import org.mvplugins.multiverse.core.teleportation.TeleportQueue
|
||||
import org.mvplugins.multiverse.core.world.WorldManager
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
class InjectionTest : TestWithMockBukkit() {
|
||||
|
||||
@Test
|
||||
fun `AnchorManager is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(AnchorManager::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `AsyncSafetyTeleporter is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(AsyncSafetyTeleporter::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `BlockSafety is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(BlockSafety::class.java))
|
||||
assertNotNull(serviceLocator.getActiveService(BlockSafety::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MVCommandManager is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(MVCommandManager::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MVEconomist is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(MVEconomist::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `LocationManipulation is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(LocationManipulation::class.java))
|
||||
assertNotNull(serviceLocator.getActiveService(LocationManipulation::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `TeleportQueue is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(TeleportQueue::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MVWorldManager is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(WorldManager::class.java))
|
||||
assertNotNull(serviceLocator.getActiveService(WorldManager::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `CoreListener(s) is available as a service`() {
|
||||
val listeners = assertNotNull(serviceLocator.getAllServices(CoreListener::class.java))
|
||||
assertEquals(7, listeners.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `CoreConfig is available as a service`() {
|
||||
assertNotNull(serviceLocator.getActiveService(CoreConfig::class.java))
|
||||
assertNotNull(serviceLocator.getActiveService(CoreConfig::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Commands are available as services`() {
|
||||
val commands = serviceLocator.getAllActiveServices(CoreCommand::class.java)
|
||||
assertEquals(57, commands.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Destinations are available as services`() {
|
||||
val destinations = serviceLocator.getAllActiveServices(Destination::class.java)
|
||||
assertEquals(6, destinations.size)
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.mock;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mockbukkit.mockbukkit.ServerMock;
|
||||
import org.mockbukkit.mockbukkit.command.CommandMapMock;
|
||||
import org.mockbukkit.mockbukkit.world.WorldMock;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class MVServerMock extends ServerMock {
|
||||
|
||||
private final File worldContainer;
|
||||
|
||||
public MVServerMock() throws IOException {
|
||||
super();
|
||||
this.worldContainer = Files.createTempDirectory("world-container").toFile();
|
||||
this.worldContainer.deleteOnExit();
|
||||
System.out.println("Created test world folder: " + this.worldContainer.getAbsolutePath());
|
||||
}
|
||||
|
||||
// This is required for acf reflection to work
|
||||
@Override
|
||||
public @NotNull CommandMapMock getCommandMap() {
|
||||
return super.getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getWorldContainer() {
|
||||
return this.worldContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(@NotNull WorldCreator creator) {
|
||||
WorldMock world = new MVWorldMock(creator);
|
||||
world.getWorldFolder().mkdirs();
|
||||
createFile(new File(world.getWorldFolder(), "uid.dat"));
|
||||
createFile(new File(world.getWorldFolder(), "level.dat"));
|
||||
addWorld(world);
|
||||
return world;
|
||||
}
|
||||
|
||||
private void createFile(File file) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.mock;
|
||||
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mockbukkit.mockbukkit.MockBukkit;
|
||||
import org.mockbukkit.mockbukkit.world.WorldMock;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class MVWorldMock extends WorldMock {
|
||||
|
||||
private final File worldFolder;
|
||||
|
||||
public MVWorldMock(@NotNull WorldCreator creator) {
|
||||
super(creator);
|
||||
this.worldFolder = new File(MockBukkit.getMock().getWorldContainer(), getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getWorldFolder() {
|
||||
return this.worldFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MVWorldMock{'name': '" + this.getName() + "'}";
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.utils
|
||||
|
||||
import org.bukkit.Material
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNull
|
||||
|
||||
class MaterialConverterTest {
|
||||
|
||||
@Test
|
||||
fun `Convert dirt name to material`() {
|
||||
assertEquals(Material.DIRT, MaterialConverter.stringToMaterial("dirt"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Convert Spruce Planks numerical id to material`() {
|
||||
assertEquals(Material.SPRUCE_PLANKS, MaterialConverter.stringToMaterial("5:1"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Convert Oak Sapling item id to material`() {
|
||||
assertEquals(Material.OAK_SAPLING, MaterialConverter.stringToMaterial("minecraft:oak_sapling"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Convert invalid string to material`() {
|
||||
assertNull(MaterialConverter.stringToMaterial("invalid"))
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.utils
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class StringFormatterTest {
|
||||
@Test
|
||||
fun `StringFormatter parseQuotesInArgs`() {
|
||||
assertEquals(
|
||||
listOf("before", "this is a test", "after"),
|
||||
StringFormatter.parseQuotesInArgs(arrayOf("before", "\"this", "is", "a", "test\"", "after"))
|
||||
)
|
||||
assertEquals(
|
||||
listOf("\""),
|
||||
StringFormatter.parseQuotesInArgs(arrayOf("\""))
|
||||
)
|
||||
assertEquals(
|
||||
listOf("\"", "after"),
|
||||
StringFormatter.parseQuotesInArgs(arrayOf("\"", "after"))
|
||||
)
|
||||
assertEquals(
|
||||
listOf("\"word", "after"),
|
||||
StringFormatter.parseQuotesInArgs(arrayOf("\"word", "after"))
|
||||
)
|
||||
assertEquals(
|
||||
listOf("word\"", "after\""),
|
||||
StringFormatter.parseQuotesInArgs(arrayOf("word\"", "after\""))
|
||||
)
|
||||
assertEquals(
|
||||
listOf("word\"", "af\"ter"),
|
||||
StringFormatter.parseQuotesInArgs(arrayOf("word\"", "af\"ter"))
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `StringFormatter quoteMultiWordString`() {
|
||||
assertEquals(
|
||||
"\"this is a test\"",
|
||||
StringFormatter.quoteMultiWordString("this is a test")
|
||||
)
|
||||
assertEquals(
|
||||
"test",
|
||||
StringFormatter.quoteMultiWordString("test")
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.utils
|
||||
|
||||
import org.mvplugins.multiverse.core.utils.matcher.ExactStringMatcher
|
||||
import org.mvplugins.multiverse.core.utils.matcher.RegexStringMatcher
|
||||
import org.mvplugins.multiverse.core.utils.matcher.WildcardStringMatcher
|
||||
import kotlin.test.Test
|
||||
|
||||
class StringMatcherTest {
|
||||
|
||||
@Test
|
||||
fun `exact string matcher - single string`() {
|
||||
val matcher = ExactStringMatcher("test")
|
||||
assert(matcher.matches("test"))
|
||||
assert(!matcher.matches("Test"))
|
||||
assert(!matcher.matches("testing"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `exact string matcher - multiple strings`() {
|
||||
val matcher = ExactStringMatcher(setOf("test", "example", "sample"));
|
||||
assert(matcher.matches("test"))
|
||||
assert(matcher.matches("example"))
|
||||
assert(matcher.matches("sample"))
|
||||
assert(!matcher.matches("Test"))
|
||||
assert(!matcher.matches("testing"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `wildcard string matcher - single`() {
|
||||
val matcher = WildcardStringMatcher("test*")
|
||||
assert(matcher.matches("test"))
|
||||
assert(matcher.matches("test123"))
|
||||
assert(matcher.matches("testing"))
|
||||
assert(!matcher.matches("TEST"))
|
||||
assert(!matcher.matches("nottest123"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `wildcard string matcher - multiple`() {
|
||||
val matcher = WildcardStringMatcher("test-*_*-world")
|
||||
assert(matcher.matches("test-123_pl-world"))
|
||||
assert(matcher.matches("test-abc_xyz-world"))
|
||||
assert(matcher.matches("test-hello_world-world"))
|
||||
assert(!matcher.matches("test-hello-world"))
|
||||
assert(!matcher.matches("test-hello_world-world!"))
|
||||
assert(!matcher.matches("TEST-123_PL-WORLD"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `regex string matcher`() {
|
||||
val matcher = RegexStringMatcher("r=^test[0-9]+$")
|
||||
assert(matcher.matches("test123"))
|
||||
assert(matcher.matches("test456"))
|
||||
assert(!matcher.matches("test"))
|
||||
assert(!matcher.matches("TEST123"))
|
||||
assert(!matcher.matches("testing"))
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.world
|
||||
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.World.Environment
|
||||
import org.bukkit.entity.EntityType
|
||||
import org.bukkit.entity.SpawnCategory
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.economy.MVEconomist
|
||||
import org.mvplugins.multiverse.core.world.location.SpawnLocation
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.test.*
|
||||
|
||||
class WorldConfigMangerTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var worldConfigManager : WorldsConfigManager
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
val defaultWorldsData = getResourceAsText("/worlds/default_worlds.yml")
|
||||
assertNotNull(defaultWorldsData)
|
||||
val worldsFile = File(Path.of(multiverseCore.dataFolder.absolutePath, "worlds.yml").absolutePathString())
|
||||
if (worldsFile.exists()) worldsFile.delete()
|
||||
worldsFile.writeText(defaultWorldsData)
|
||||
|
||||
worldConfigManager = serviceLocator.getActiveService(WorldsConfigManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldsConfigManager is not available as a service") }
|
||||
assertTrue(worldConfigManager.load().isSuccess)
|
||||
assertTrue(worldConfigManager.isLoaded)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Old world config is migrated`() {
|
||||
val oldConfig = getResourceAsText("/worlds/old_worlds.yml")
|
||||
assertNotNull(oldConfig)
|
||||
File(Path.of(multiverseCore.dataFolder.absolutePath, "worlds.yml").absolutePathString()).writeText(oldConfig)
|
||||
|
||||
assertTrue(worldConfigManager.load().isSuccess)
|
||||
assertTrue(worldConfigManager.save().isSuccess)
|
||||
|
||||
val endWorldConfig = worldConfigManager.getWorldConfig("world_the_end").orNull
|
||||
assertNotNull(endWorldConfig)
|
||||
|
||||
assertEquals("&aworld the end", endWorldConfig.alias)
|
||||
assertEquals(Environment.THE_END, endWorldConfig.environment)
|
||||
assertFalse(endWorldConfig.isEntryFeeEnabled)
|
||||
assertEquals(MVEconomist.VAULT_ECONOMY_MATERIAL, endWorldConfig.entryFeeCurrency)
|
||||
assertEquals(0.0, endWorldConfig.entryFeeAmount)
|
||||
|
||||
val worldConfig = worldConfigManager.getWorldConfig("world.a.b").orNull
|
||||
assertNotNull(worldConfig)
|
||||
|
||||
assertEquals(-5176596003035866649, worldConfig.seed)
|
||||
assertEquals(listOf("test"), worldConfig.worldBlacklist)
|
||||
assertTrue(worldConfig.isEntryFeeEnabled)
|
||||
assertEquals(Material.DIRT, worldConfig.entryFeeCurrency)
|
||||
assertEquals(5.0, worldConfig.entryFeeAmount)
|
||||
|
||||
val world2Config = worldConfigManager.getWorldConfig("world.a.c").orNull
|
||||
assertNotNull(world2Config)
|
||||
|
||||
assertConfigEquals("/worlds/migrated_worlds.yml", "worlds.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Add a new world to config`() {
|
||||
val worldConfig = worldConfigManager.addWorldConfig("new.world")
|
||||
assertNotNull(worldConfig)
|
||||
assertEquals("new.world", worldConfig.worldName)
|
||||
assertTrue(worldConfigManager.save().isSuccess)
|
||||
assertConfigEquals("/worlds/newworld_worlds.yml", "worlds.yml")
|
||||
|
||||
// Make sure the world still can be loaded after save
|
||||
assertTrue(worldConfigManager.load().isSuccess)
|
||||
assertEquals("new.world", worldConfigManager.getWorldConfig("new.world").orNull?.worldName)
|
||||
assertConfigEquals("/worlds/newworld_worlds.yml", "worlds.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating existing world properties`() {
|
||||
val worldConfig = worldConfigManager.getWorldConfig("world").orNull
|
||||
assertNotNull(worldConfig)
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("adjust-spawn", true).isSuccess)
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("alias", "newalias").isSuccess)
|
||||
assertTrue(worldConfig.setSpawnLocation(
|
||||
SpawnLocation(
|
||||
-50.0,
|
||||
50.0,
|
||||
50.0
|
||||
)
|
||||
).isSuccess)
|
||||
worldConfig.entitySpawnConfig.getSpawnCategoryConfig(SpawnCategory.MISC).isSpawn = false
|
||||
worldConfig.entitySpawnConfig.getSpawnCategoryConfig(SpawnCategory.ANIMAL).tickRate = 111
|
||||
worldConfig.entitySpawnConfig.getSpawnCategoryConfig(SpawnCategory.ANIMAL).exceptions = listOf(EntityType.COW, EntityType.PIG)
|
||||
assertTrue(worldConfigManager.save().isSuccess)
|
||||
assertConfigEquals("/worlds/updated_worlds.yml", "worlds.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Delete world section from config`() {
|
||||
worldConfigManager.deleteWorldConfig("world")
|
||||
assertTrue(worldConfigManager.save().isSuccess)
|
||||
assertConfigEquals("/worlds/delete_worlds.yml", "worlds.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Edge case parsing tests for world config`() {
|
||||
val edgecaseConfig = getResourceAsText("/worlds/edgecase_worlds.yml")
|
||||
assertNotNull(edgecaseConfig)
|
||||
File(Path.of(multiverseCore.dataFolder.absolutePath, "worlds.yml").absolutePathString()).writeText(edgecaseConfig)
|
||||
|
||||
assertTrue(worldConfigManager.load().isSuccess)
|
||||
assertTrue(worldConfigManager.save().isSuccess)
|
||||
|
||||
val worldConfig = assertNotNull(worldConfigManager.getWorldConfig("world").orNull)
|
||||
|
||||
assertEquals("1234", worldConfig.alias)
|
||||
assertTrue(worldConfig.bedRespawn)
|
||||
assertEquals(GameMode.SURVIVAL, worldConfig.gameMode)
|
||||
assertEquals(4.0, worldConfig.scale)
|
||||
assertEquals(listOf("a", "1", "2"), worldConfig.worldBlacklist)
|
||||
assertEquals(listOf(EntityType.COW), worldConfig.entitySpawnConfig.getSpawnCategoryConfig(SpawnCategory.ANIMAL).exceptions)
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.world
|
||||
|
||||
import org.bukkit.Material
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.test.*
|
||||
|
||||
class WorldConfigTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var worldConfigManager : WorldsConfigManager
|
||||
private lateinit var worldConfig : WorldConfig
|
||||
private lateinit var worldNetherConfig : WorldConfig
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
val defaultConfig = getResourceAsText("/worlds/default_worlds.yml")
|
||||
assertNotNull(defaultConfig)
|
||||
File(Path.of(multiverseCore.dataFolder.absolutePath, "worlds.yml").absolutePathString()).writeText(defaultConfig)
|
||||
|
||||
worldConfigManager = serviceLocator.getActiveService(WorldsConfigManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldsConfigManager is not available as a service") }
|
||||
|
||||
assertTrue(worldConfigManager.load().isSuccess)
|
||||
worldConfig = worldConfigManager.getWorldConfig("world").orNull.takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldConfig for world is not available") }
|
||||
assertNotNull(worldConfig)
|
||||
worldNetherConfig = worldConfigManager.getWorldConfig("world_nether").orNull.takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldConfig for world is not available") }
|
||||
assertNotNull(worldNetherConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Getting existing world property with getProperty returns expected value`() {
|
||||
assertEquals("my world", worldConfig.stringPropertyHandle.getProperty("alias").get())
|
||||
assertEquals(false, worldConfig.stringPropertyHandle.getProperty("hidden").get())
|
||||
assertEquals(1.0, worldConfig.stringPropertyHandle.getProperty("scale").get())
|
||||
assertEquals(8.0, worldNetherConfig.stringPropertyHandle.getProperty("scale").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Getting non-existing world property with getProperty returns null`() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.getProperty("invalid-property").isFailure)
|
||||
assertTrue(worldConfig.stringPropertyHandle.getProperty("version").isFailure)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Getting existing world property by getter returns expected value`() {
|
||||
assertEquals("my world", worldConfig.alias)
|
||||
assertEquals(false, worldConfig.isHidden)
|
||||
assertEquals(emptyList(), worldConfig.worldBlacklist)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating an existing world property with setProperty reflects the changes in getProperty`() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("adjust-spawn", true).isSuccess)
|
||||
assertEquals(true, worldConfig.stringPropertyHandle.getProperty("adjust-spawn").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("alias", "abc").isSuccess)
|
||||
assertEquals("abc", worldConfig.stringPropertyHandle.getProperty("alias").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("scale", 2.0).isSuccess)
|
||||
assertEquals(2.0, worldConfig.stringPropertyHandle.getProperty("scale").get())
|
||||
|
||||
val blacklists = listOf("a", "b", "c")
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("world-blacklist", blacklists).isSuccess)
|
||||
assertEquals(blacklists, worldConfig.stringPropertyHandle.getProperty("world-blacklist").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("entryfee-currency", Material.JUNGLE_WOOD).isSuccess)
|
||||
assertEquals(Material.JUNGLE_WOOD, worldConfig.stringPropertyHandle.getProperty("entryfee-currency").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating an existing world property with setPropertyString reflects the changes in getProperty`() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("adjust-spawn", "true").isSuccess)
|
||||
assertEquals(true, worldConfig.getStringPropertyHandle().getProperty("adjust-spawn").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("alias", "abc").isSuccess)
|
||||
assertEquals("abc", worldConfig.stringPropertyHandle.getProperty("alias").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("scale", "2.0").isSuccess)
|
||||
assertEquals(2.0, worldConfig.stringPropertyHandle.getProperty("scale").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("world-blacklist", "a,b,c").isSuccess)
|
||||
assertEquals(listOf("a", "b", "c"), worldConfig.stringPropertyHandle.getProperty("world-blacklist").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("entryfee-currency", "jungle_wood").isSuccess)
|
||||
assertEquals(Material.JUNGLE_WOOD, worldConfig.stringPropertyHandle.getProperty("entryfee-currency").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating a non-existing property with setProperty returns false`() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("invalid-property", false).isFailure)
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("version", 1.1).isFailure)
|
||||
}
|
||||
}
|
||||
@@ -1,327 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.world
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.World
|
||||
import org.bukkit.WorldType
|
||||
import org.hamcrest.MatcherAssert.assertThat
|
||||
import org.mockbukkit.mockbukkit.matcher.plugin.PluginManagerFiredEventClassMatcher.hasFiredEventInstance
|
||||
import org.mockbukkit.mockbukkit.matcher.plugin.PluginManagerFiredEventClassMatcher.hasNotFiredEventInstance
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.event.world.*
|
||||
import org.mvplugins.multiverse.core.world.options.CloneWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.CreateWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.DeleteWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.LoadWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.RegenWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.RemoveWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.options.UnloadWorldOptions
|
||||
import org.mvplugins.multiverse.core.world.reasons.CloneFailureReason
|
||||
import org.mvplugins.multiverse.core.world.reasons.CreateFailureReason
|
||||
import org.mvplugins.multiverse.core.world.reasons.LoadFailureReason
|
||||
import java.io.File
|
||||
import kotlin.test.*
|
||||
|
||||
class WorldManagerTest : TestWithMockBukkit() {
|
||||
|
||||
private lateinit var worldManager: WorldManager
|
||||
private lateinit var world: LoadedMultiverseWorld
|
||||
private lateinit var world2: LoadedMultiverseWorld
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
worldManager = serviceLocator.getActiveService(WorldManager::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldManager is not available as a service") }
|
||||
|
||||
assertTrue(worldManager.createWorld(CreateWorldOptions.worldName("world")).isSuccess)
|
||||
world = worldManager.getLoadedWorld("world").get()
|
||||
assertNotNull(world)
|
||||
|
||||
assertTrue(worldManager.createWorld(CreateWorldOptions.worldName("world2")).isSuccess)
|
||||
world2 = worldManager.getLoadedWorld("world2").get()
|
||||
assertNotNull(world2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create world with custom options`() {
|
||||
assertTrue(worldManager.createWorld(
|
||||
CreateWorldOptions.worldName("Section/my-nether_world")
|
||||
.environment(World.Environment.NETHER)
|
||||
.generateStructures(false)
|
||||
.seed(1234L)
|
||||
.useSpawnAdjust(false)
|
||||
.worldType(WorldType.FLAT)
|
||||
).isSuccess)
|
||||
|
||||
val getWorld = worldManager.getLoadedWorld("Section/my-nether_world")
|
||||
assertTrue(getWorld.isDefined)
|
||||
val world = getWorld.get()
|
||||
assertNotNull(world)
|
||||
assertEquals("Section/my-nether_world", world.name)
|
||||
assertEquals(World.Environment.NETHER, world.environment)
|
||||
assertFalse(world.canGenerateStructures().get())
|
||||
assertEquals(1234L, world.seed)
|
||||
assertFalse(world.adjustSpawn)
|
||||
assertEquals(WorldType.FLAT, world.worldType.get())
|
||||
assertEquals("", world.generator)
|
||||
assertEquals(8.0, world.scale)
|
||||
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldLoadedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldCreatedEvent::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create world failed - invalid worldname`() {
|
||||
assertEquals(
|
||||
CreateFailureReason.INVALID_WORLDNAME,
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("*!@^&#*(")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create world failed - world exists and loaded`() {
|
||||
assertEquals(
|
||||
CreateFailureReason.WORLD_EXIST_LOADED,
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("world")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create world failed - world exists and loaded (case insensitive)`() {
|
||||
assertEquals(
|
||||
CreateFailureReason.WORLD_EXIST_LOADED,
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("WoRld2")).failureReason
|
||||
)
|
||||
assertEquals(
|
||||
CreateFailureReason.WORLD_EXIST_LOADED,
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("WORLD2")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create world failed - world exists but unloaded`() {
|
||||
assertTrue(worldManager.unloadWorld(UnloadWorldOptions.world(world)).isSuccess)
|
||||
assertEquals(
|
||||
CreateFailureReason.WORLD_EXIST_UNLOADED,
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("world")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Create world failed - world folder exists`() {
|
||||
File(Bukkit.getWorldContainer(), "worldfolder").mkdir()
|
||||
assertEquals(
|
||||
CreateFailureReason.WORLD_EXIST_FOLDER,
|
||||
worldManager.createWorld(CreateWorldOptions.worldName("worldfolder")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Remove world`() {
|
||||
assertTrue(worldManager.removeWorld(RemoveWorldOptions.world(world)).isSuccess)
|
||||
assertFalse(worldManager.getWorld("world").isDefined)
|
||||
assertFalse(worldManager.getLoadedWorld("world").isDefined)
|
||||
assertFalse(worldManager.getUnloadedWorld("world").isDefined)
|
||||
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldUnloadedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldRemovedEvent::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Delete world`() {
|
||||
assertTrue(File(Bukkit.getWorldContainer(), "world").isDirectory)
|
||||
assertTrue(worldManager.deleteWorld(DeleteWorldOptions.world(world)).isSuccess)
|
||||
assertFalse(worldManager.getLoadedWorld("world").isDefined)
|
||||
assertFalse(File(Bukkit.getWorldContainer(), "world").isDirectory)
|
||||
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldDeleteEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldUnloadedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldRemovedEvent::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Unload and load world`() {
|
||||
assertTrue(worldManager.unloadWorld(UnloadWorldOptions.world(world2).saveBukkitWorld(true)).isSuccess)
|
||||
assertFalse(world2.isLoaded)
|
||||
assertFalse(world2.bukkitWorld.isDefined)
|
||||
assertFalse(worldManager.getLoadedWorld("world2").isDefined)
|
||||
assertTrue(worldManager.getWorld("world2").isDefined)
|
||||
assertTrue(worldManager.getUnloadedWorld("world2").isDefined)
|
||||
|
||||
assertTrue(worldManager.loadWorld(LoadWorldOptions.world(world2)).isSuccess)
|
||||
assertTrue(world2.isLoaded)
|
||||
assertTrue(worldManager.getLoadedWorld("world2").flatMap{ w -> w.bukkitWorld }.isDefined)
|
||||
assertTrue(worldManager.getLoadedWorld("world2").isDefined)
|
||||
assertFalse(worldManager.getUnloadedWorld("world2").isDefined)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Load world failed - invalid world folder`() {
|
||||
assertTrue(worldManager.unloadWorld(UnloadWorldOptions.world(world2)).isSuccess)
|
||||
File(Bukkit.getWorldContainer(), "world2/").deleteRecursively()
|
||||
assertEquals(
|
||||
LoadFailureReason.WORLD_FOLDER_INVALID,
|
||||
worldManager.loadWorld(LoadWorldOptions.world(world2)).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Load world failed - non-existent world`() {
|
||||
assertEquals(
|
||||
LoadFailureReason.WORLD_NON_EXISTENT,
|
||||
worldManager.loadWorld("ghost").failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Load world failed - world folder exists but not imported`() {
|
||||
File(Bukkit.getWorldContainer(), "worldfolder").mkdir()
|
||||
File(Bukkit.getWorldContainer(), "worldfolder/level.dat").createNewFile()
|
||||
assertEquals(
|
||||
LoadFailureReason.WORLD_EXIST_FOLDER,
|
||||
worldManager.loadWorld("worldfolder").failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Regen world`() {
|
||||
assertTrue(worldManager.regenWorld(
|
||||
RegenWorldOptions
|
||||
.world(world2)
|
||||
.seed(4321L)
|
||||
).isSuccess)
|
||||
|
||||
val getWorld = worldManager.getLoadedWorld("world2")
|
||||
assertTrue(getWorld.isDefined)
|
||||
val world = getWorld.get()
|
||||
assertNotNull(world)
|
||||
assertEquals(4321L, world.seed)
|
||||
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldDeleteEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldUnloadedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldRemovedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldLoadedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldCreatedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldRegeneratedEvent::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Clone world`() {
|
||||
assertTrue(worldManager.cloneWorld(CloneWorldOptions.fromTo(world, "cloneworld").saveBukkitWorld(false)).isSuccess)
|
||||
val getWorld = worldManager.getLoadedWorld("cloneworld")
|
||||
assertTrue(getWorld.isDefined)
|
||||
val world = getWorld.get()
|
||||
assertNotNull(world)
|
||||
assertEquals("cloneworld", world.name)
|
||||
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldLoadedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldImportedEvent::class.java))
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldClonedEvent::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Clone world failed - invalid world name`() {
|
||||
assertEquals(
|
||||
CloneFailureReason.INVALID_WORLDNAME,
|
||||
worldManager.cloneWorld(CloneWorldOptions.fromTo(world, "HU(@*!#")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Clone world failed - target world exists and loaded`() {
|
||||
assertEquals(
|
||||
CloneFailureReason.WORLD_EXIST_LOADED,
|
||||
worldManager.cloneWorld(CloneWorldOptions.fromTo(world, "world2")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Clone world failed - target world exists but unloaded`() {
|
||||
assertTrue(worldManager.unloadWorld(UnloadWorldOptions.world(world2)).isSuccess)
|
||||
assertEquals(
|
||||
CloneFailureReason.WORLD_EXIST_UNLOADED,
|
||||
worldManager.cloneWorld(CloneWorldOptions.fromTo(world, "world2")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Clone world failed - target world folder exists`() {
|
||||
File(Bukkit.getWorldContainer(), "worldfolder").mkdir()
|
||||
assertEquals(
|
||||
CloneFailureReason.WORLD_EXIST_FOLDER,
|
||||
worldManager.cloneWorld(CloneWorldOptions.fromTo(world, "worldfolder")).failureReason
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Get potential worlds`() {
|
||||
File(Bukkit.getWorldContainer(), "newworld1").mkdir()
|
||||
File(Bukkit.getWorldContainer(), "newworld1/level.dat").createNewFile()
|
||||
File(Bukkit.getWorldContainer(), "newworld2").mkdir()
|
||||
File(Bukkit.getWorldContainer(), "newworld2/level.dat").createNewFile()
|
||||
assertEquals(setOf("newworld1", "newworld2"), worldManager.getPotentialWorlds().toSet())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Get world with alias`() {
|
||||
world.setAlias("testalias")
|
||||
assertEquals(world, worldManager.getLoadedWorldByNameOrAlias("testalias").orNull)
|
||||
assertEquals(world, worldManager.getWorldByNameOrAlias("testalias").orNull)
|
||||
assertNull(worldManager.getUnloadedWorldByNameOrAlias("testalias").orNull)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Get world`() {
|
||||
assertEquals(world, worldManager.getLoadedWorld("world").orNull)
|
||||
assertNull(worldManager.getUnloadedWorld("world").orNull)
|
||||
assertEquals(world, worldManager.getWorld("world").orNull)
|
||||
|
||||
assertTrue(worldManager.isLoadedWorld("world"))
|
||||
assertFalse(worldManager.isUnloadedWorld("world"))
|
||||
assertTrue(worldManager.isWorld("world"))
|
||||
|
||||
val unloadedWorld = worldManager.unloadWorld(UnloadWorldOptions.world(world)).get()
|
||||
|
||||
assertNull(worldManager.getLoadedWorld("world").orNull)
|
||||
assertEquals(unloadedWorld, worldManager.getUnloadedWorld("world").orNull)
|
||||
assertEquals(unloadedWorld, worldManager.getWorld("world").orNull)
|
||||
|
||||
assertFalse(worldManager.isLoadedWorld("world"))
|
||||
assertTrue(worldManager.isUnloadedWorld("world"))
|
||||
assertTrue(worldManager.isWorld("world"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Get world is case insensitive`() {
|
||||
assertEquals(world2, worldManager.getLoadedWorld("WORLD2").orNull)
|
||||
assertNull(worldManager.getUnloadedWorld("wOrld2").orNull)
|
||||
assertEquals(world2, worldManager.getWorld("wOrld2").orNull)
|
||||
|
||||
assertTrue(worldManager.isLoadedWorld("WoRlD2"))
|
||||
assertFalse(worldManager.isUnloadedWorld("WoRlD2"))
|
||||
assertTrue(worldManager.isWorld("wORLD2"))
|
||||
|
||||
val unloadedWorld2 = worldManager.unloadWorld(UnloadWorldOptions.world(world2)).get()
|
||||
|
||||
assertNull(worldManager.getLoadedWorld("wOrld2").orNull)
|
||||
assertEquals(unloadedWorld2, worldManager.getUnloadedWorld("wOrld2").orNull)
|
||||
assertEquals(unloadedWorld2, worldManager.getWorld("wORLD2").orNull)
|
||||
|
||||
assertFalse(worldManager.isLoadedWorld("WoRlD2"))
|
||||
assertTrue(worldManager.isUnloadedWorld("WoRlD2"))
|
||||
assertTrue(worldManager.isWorld("wORLD2"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Set different value - MVWorldPropertyChangedEvent event is fired`() {
|
||||
server.pluginManager.clearEvents()
|
||||
world.scale = 8.0
|
||||
assertThat(server.pluginManager, hasFiredEventInstance(MVWorldPropertyChangedEvent::class.java))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Set equal value - MVWorldPropertyChangedEvent event is not fired`() {
|
||||
server.pluginManager.clearEvents()
|
||||
world.scale = 1.0
|
||||
assertThat(server.pluginManager, hasNotFiredEventInstance(MVWorldPropertyChangedEvent::class.java))
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.world
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.world.helpers.WorldNameChecker
|
||||
import java.io.File
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.*
|
||||
|
||||
class WorldNameCheckerTest : TestWithMockBukkit() {
|
||||
|
||||
lateinit var worldNameChecker: WorldNameChecker
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
worldNameChecker = serviceLocator.getActiveService(WorldNameChecker::class.java).takeIf { it != null } ?: run {
|
||||
throw IllegalStateException("WorldNameChecker is not available as a service") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Valid world name`() {
|
||||
assertEquals(WorldNameChecker.NameStatus.VALID, worldNameChecker.checkName("test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Invalid characters in world name`() {
|
||||
assertEquals(WorldNameChecker.NameStatus.INVALID_CHARS, worldNameChecker.checkName("test!"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Empty world name`() {
|
||||
assertEquals(WorldNameChecker.NameStatus.EMPTY, worldNameChecker.checkName(null))
|
||||
assertEquals(WorldNameChecker.NameStatus.EMPTY, worldNameChecker.checkName(""))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Blacklisted world name`() {
|
||||
assertEquals(WorldNameChecker.NameStatus.BLACKLISTED, worldNameChecker.checkName("logs"))
|
||||
assertEquals(WorldNameChecker.NameStatus.BLACKLISTED, worldNameChecker.checkName("plugins"))
|
||||
assertEquals(WorldNameChecker.NameStatus.BLACKLISTED, worldNameChecker.checkName("CACHE"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Valid world folder`() {
|
||||
File(Bukkit.getWorldContainer(), "test").mkdir()
|
||||
File(Bukkit.getWorldContainer(), "test/level.dat").createNewFile()
|
||||
assertEquals(WorldNameChecker.FolderStatus.VALID, worldNameChecker.checkFolder("test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Not a valid world folder`() {
|
||||
File(Bukkit.getWorldContainer(), "test").mkdir()
|
||||
File(Bukkit.getWorldContainer(), "test/random.txt").createNewFile()
|
||||
assertEquals(WorldNameChecker.FolderStatus.NOT_A_WORLD, worldNameChecker.checkFolder("test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `World folder does not exist`() {
|
||||
File(Bukkit.getWorldContainer(), "test").mkdir()
|
||||
assertEquals(WorldNameChecker.FolderStatus.DOES_NOT_EXIST, worldNameChecker.checkFolder("test2"))
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package org.mvplugins.multiverse.core.world.helper
|
||||
|
||||
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
||||
import org.mvplugins.multiverse.core.world.helpers.DimensionFinder.DimensionFormat
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFailsWith
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
class DimensionFormatTest : TestWithMockBukkit() {
|
||||
|
||||
@Test
|
||||
fun `Test invalid DimensionFormat`() {
|
||||
assertFailsWith(IllegalArgumentException::class) {
|
||||
DimensionFormat("%idk%_nether")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test DimensionFormat replace`() {
|
||||
val dimensionFormat = DimensionFormat("%overworld%_nether")
|
||||
assertEquals("cool_nether", dimensionFormat.replaceOverworld("cool"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test DimensionFormat get overworld`() {
|
||||
val dimensionFormat = DimensionFormat("%overworld%_n")
|
||||
assertEquals("cool", dimensionFormat.getOverworldFromName("cool_n").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test DimensionFormat does not match`() {
|
||||
val dimensionFormat = DimensionFormat("%overworld%_nether")
|
||||
assertFalse(dimensionFormat.getOverworldFromName("cool_end").isDefined)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
anchors:
|
||||
a1: w1:0.50,70.00,0.50:-68.25:10.35
|
||||
a2: w2:3.3,9.9,6.6:-1.1:2
|
||||
a3: w3:3.00,3.00,3.00:-3.00:3.00
|
||||
@@ -1,3 +0,0 @@
|
||||
anchors:
|
||||
a1: w1:0.50,70.00,0.50:-68.25:10.35
|
||||
a2: w2:3.3,9.9,6.6:-1.1:2
|
||||
@@ -1,38 +0,0 @@
|
||||
world:
|
||||
enforce-access: false
|
||||
enforce-gamemode: true
|
||||
auto-purge-entities: false
|
||||
|
||||
teleport:
|
||||
use-finer-teleport-permissions: true
|
||||
concurrent-teleport-limit: 50
|
||||
teleport-intercept: true
|
||||
|
||||
spawn:
|
||||
first-spawn-override: true
|
||||
first-spawn-location: ''
|
||||
enable-join-destination: false
|
||||
join-destination: ''
|
||||
|
||||
portal:
|
||||
use-custom-portal-search: false
|
||||
custom-portal-search-radius: 128
|
||||
|
||||
messaging:
|
||||
enable-chat-prefix: false
|
||||
chat-prefix-format: '[%world%]%chat%'
|
||||
register-papi-hook: true
|
||||
default-locale: en
|
||||
per-player-locale: true
|
||||
?!
|
||||
command:
|
||||
resolve-alias-name: true
|
||||
confirm-mode: enable
|
||||
use-confirm-otp: true
|
||||
|
||||
misc:
|
||||
global-debug: 0
|
||||
silent-start: false
|
||||
show-donation-message: true
|
||||
|
||||
version: 5.1
|
||||
@@ -1,65 +0,0 @@
|
||||
world:
|
||||
auto-import-default-worlds: true
|
||||
auto-import-3rd-party-worlds: true
|
||||
enforce-access: false
|
||||
enforce-gamemode: true
|
||||
enforce-flight: true
|
||||
apply-entity-spawn-rate: true
|
||||
apply-entity-spawn-limit: true
|
||||
auto-purge-entities: false
|
||||
world-name-format:
|
||||
nether: '%overworld%_nether'
|
||||
end: '%overworld%_the_end'
|
||||
|
||||
teleport:
|
||||
use-finer-teleport-permissions: true
|
||||
passenger-mode: default
|
||||
concurrent-teleport-limit: 50
|
||||
teleport-intercept: true
|
||||
safe-location-horizontal-search-radius: 3
|
||||
safe-location-vertical-search-radius: 3
|
||||
|
||||
spawn:
|
||||
first-spawn-override: false
|
||||
first-spawn-location: ''
|
||||
enable-join-destination: false
|
||||
join-destination: ''
|
||||
default-respawn-in-overworld: true
|
||||
default-respawn-within-same-world: true
|
||||
enforce-respawn-at-world-spawn: true
|
||||
|
||||
portal:
|
||||
use-custom-portal-search: false
|
||||
custom-portal-search-radius: 128
|
||||
|
||||
messaging:
|
||||
enable-chat-prefix: false
|
||||
chat-prefix-format: '[%world%]%chat%'
|
||||
register-papi-hook: true
|
||||
default-locale: en
|
||||
per-player-locale: true
|
||||
|
||||
command:
|
||||
resolve-alias-name: true
|
||||
simplified-destination-tab-completion: false
|
||||
confirm-mode: enable
|
||||
use-confirm-otp: true
|
||||
confirm-timeout: 30
|
||||
show-legacy-aliases: false
|
||||
|
||||
event-priority:
|
||||
player-portal: high
|
||||
player-respawn: low
|
||||
player-spawn-location: normal
|
||||
player-teleport: highest
|
||||
|
||||
misc:
|
||||
bukkit-yml-path: bukkit.yml
|
||||
server-properties-path: server.properties
|
||||
auto-detect-generator-plugins: true
|
||||
global-debug: 0
|
||||
debug-permissions: false
|
||||
silent-start: false
|
||||
show-donation-message: true
|
||||
|
||||
version: 5.2
|
||||
@@ -1,20 +0,0 @@
|
||||
multiverse-configuration:
|
||||
==: com.onarandombox.MultiverseCore.MultiverseCoreConfiguration
|
||||
enforceaccess: 'true'
|
||||
prefixchat: 'false'
|
||||
prefixchatformat: '[%world%]>>%chat%'
|
||||
useasyncchat: 'true'
|
||||
teleportintercept: 'false'
|
||||
firstspawnoverride: 'true'
|
||||
displaypermerrors: 'false'
|
||||
enablebuscript: 'false'
|
||||
globaldebug: '2'
|
||||
silentstart: 'false'
|
||||
messagecooldown: '5000'
|
||||
version: '2.9'
|
||||
firstspawnworld: world
|
||||
teleportcooldown: '1000'
|
||||
defaultportalsearch: 'true'
|
||||
portalsearchradius: '128'
|
||||
autopurge: 'true'
|
||||
idonotwanttodonate: 'true'
|
||||
@@ -1,156 +0,0 @@
|
||||
world:
|
||||
adjust-spawn: false
|
||||
alias: my world
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: normal
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
world_nether:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: nether
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
@@ -1,78 +0,0 @@
|
||||
world_nether:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: nether
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
@@ -1,158 +0,0 @@
|
||||
world:
|
||||
adjust-spawn: false
|
||||
alias: 1234 # should be parsed as string and not integer
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: allow # should parse to true as boolean
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: dirt # should be parsed to @minecraft:dirt
|
||||
environment: normal
|
||||
gamemode: sUrvivAl # random casing shouldn't affect parsing
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: '4' # string number should be parsed as double
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
spawn: falSe
|
||||
tick-rate: 123
|
||||
spawn-limit: '@unset'
|
||||
exceptions: [ cow ]
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: # should be parsed as list of string
|
||||
- a
|
||||
- 1
|
||||
- 2
|
||||
version: 1.2
|
||||
world_nether:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: nether
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
@@ -1,236 +0,0 @@
|
||||
world_the_end:
|
||||
adjust-spawn: false
|
||||
alias: '&aworld the end'
|
||||
allow-advancement-grant: true
|
||||
allow-flight: true
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: the_end
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 16.0
|
||||
seed: -5176596003035866649
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: 0.0
|
||||
y: 65.0
|
||||
z: 0.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@bukkit'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@bukkit'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
world[dot]a[dot]b:
|
||||
adjust-spawn: true
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: true
|
||||
amount: 5.0
|
||||
currency: DIRT
|
||||
environment: normal
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -5176596003035866649
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@bukkit'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@bukkit'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist:
|
||||
- test
|
||||
version: 1.2
|
||||
world[dot]a[dot]c:
|
||||
adjust-spawn: true
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: true
|
||||
amount: 5.0
|
||||
currency: DIRT
|
||||
environment: normal
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -5176596003035866649
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@bukkit'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@bukkit'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist:
|
||||
- test
|
||||
version: 1.2
|
||||
@@ -1,229 +0,0 @@
|
||||
world:
|
||||
adjust-spawn: false
|
||||
alias: my world
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: normal
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
world_nether:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: nether
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
new[dot]world:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
biome: '@error'
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: normal
|
||||
gamemode: survival
|
||||
generator: '@error'
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVNullLocation (It's a bug if you see this in your config file)
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
@@ -1,146 +0,0 @@
|
||||
worlds:
|
||||
world_the_end:
|
||||
==: MVWorld
|
||||
hidden: 'false'
|
||||
alias: world the end
|
||||
color: GREEN
|
||||
style: NORMAL
|
||||
pvp: 'true'
|
||||
scale: '16.0'
|
||||
respawnWorld: ''
|
||||
allowWeather: 'true'
|
||||
difficulty: NORMAL
|
||||
spawning:
|
||||
==: MVSpawnSettings
|
||||
animals:
|
||||
==: MVSpawnSubSettings
|
||||
spawn: 'true'
|
||||
spawnrate: '-1'
|
||||
exceptions: []
|
||||
monsters:
|
||||
==: MVSpawnSubSettings
|
||||
spawn: 'true'
|
||||
spawnrate: '-1'
|
||||
exceptions: []
|
||||
entryfee:
|
||||
==: MVEntryFee
|
||||
amount: '0.0'
|
||||
hunger: 'true'
|
||||
autoHeal: 'true'
|
||||
adjustSpawn: 'false'
|
||||
portalForm: ALL
|
||||
gameMode: SURVIVAL
|
||||
keepSpawnInMemory: 'true'
|
||||
spawnLocation:
|
||||
==: MVSpawnLocation
|
||||
x: 0.0
|
||||
y: 65.0
|
||||
z: 0.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
autoLoad: 'true'
|
||||
bedRespawn: 'true'
|
||||
worldBlacklist: []
|
||||
environment: THE_END
|
||||
seed: '-5176596003035866649'
|
||||
generator: 'null'
|
||||
playerLimit: '-1'
|
||||
allowFlight: 'true'
|
||||
world.a.b:
|
||||
==: MVWorld
|
||||
hidden: 'false'
|
||||
alias: ''
|
||||
color: WHITE
|
||||
style: NORMAL
|
||||
pvp: 'true'
|
||||
scale: '1.0'
|
||||
respawnWorld: ''
|
||||
allowWeather: 'true'
|
||||
difficulty: NORMAL
|
||||
spawning:
|
||||
==: MVSpawnSettings
|
||||
animals:
|
||||
==: MVSpawnSubSettings
|
||||
spawn: 'true'
|
||||
spawnrate: '-1'
|
||||
exceptions: []
|
||||
monsters:
|
||||
==: MVSpawnSubSettings
|
||||
spawn: 'true'
|
||||
spawnrate: '-1'
|
||||
exceptions: []
|
||||
entryfee:
|
||||
==: MVEntryFee
|
||||
amount: '5.0'
|
||||
currency: 'DIRT'
|
||||
hunger: 'true'
|
||||
autoHeal: 'true'
|
||||
adjustSpawn: 'true'
|
||||
portalForm: ALL
|
||||
gameMode: SURVIVAL
|
||||
keepSpawnInMemory: 'true'
|
||||
spawnLocation:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
autoLoad: 'true'
|
||||
bedRespawn: 'true'
|
||||
worldBlacklist:
|
||||
- test
|
||||
environment: NORMAL
|
||||
seed: '-5176596003035866649'
|
||||
generator: 'null'
|
||||
playerLimit: '-1'
|
||||
allowFlight: 'false'
|
||||
world.a.c:
|
||||
==: MVWorld
|
||||
hidden: 'false'
|
||||
alias: ''
|
||||
color: WHITE
|
||||
style: NORMAL
|
||||
pvp: 'true'
|
||||
scale: '1.0'
|
||||
respawnWorld: ''
|
||||
allowWeather: 'true'
|
||||
difficulty: NORMAL
|
||||
spawning:
|
||||
==: MVSpawnSettings
|
||||
animals:
|
||||
==: MVSpawnSubSettings
|
||||
spawn: 'true'
|
||||
spawnrate: '-1'
|
||||
exceptions: []
|
||||
monsters:
|
||||
==: MVSpawnSubSettings
|
||||
spawn: 'true'
|
||||
spawnrate: '-1'
|
||||
exceptions: []
|
||||
entryfee:
|
||||
==: MVEntryFee
|
||||
amount: '5.0'
|
||||
currency: 'DIRT'
|
||||
hunger: 'true'
|
||||
autoHeal: 'true'
|
||||
adjustSpawn: 'true'
|
||||
portalForm: ALL
|
||||
gameMode: SURVIVAL
|
||||
keepSpawnInMemory: 'true'
|
||||
spawnLocation:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
autoLoad: 'true'
|
||||
bedRespawn: 'true'
|
||||
worldBlacklist:
|
||||
- test
|
||||
environment: NORMAL
|
||||
seed: '-5176596003035866649'
|
||||
generator: 'null'
|
||||
playerLimit: '-1'
|
||||
allowFlight: 'false'
|
||||
@@ -1,151 +0,0 @@
|
||||
world:
|
||||
adjust-spawn: true
|
||||
alias: newalias
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: NORMAL
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: @vault-economy
|
||||
environment: NORMAL
|
||||
gamemode: SURVIVAL
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: ALL
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
world_nether:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: NORMAL
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: @vault-economy
|
||||
environment: NETHER
|
||||
gamemode: SURVIVAL
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: ALL
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVNullLocation (It's a bug if you see this in your config file)
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
@@ -1,158 +0,0 @@
|
||||
world:
|
||||
adjust-spawn: true
|
||||
alias: newalias
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: normal
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -50.0
|
||||
y: 50.0
|
||||
z: 50.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
spawn: true
|
||||
tick-rate: 111
|
||||
spawn-limit: '@unset'
|
||||
exceptions:
|
||||
- cow
|
||||
- pig
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
spawn: false
|
||||
tick-rate: '@unset'
|
||||
spawn-limit: '@unset'
|
||||
exceptions: [ ]
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
world_nether:
|
||||
adjust-spawn: false
|
||||
alias: ''
|
||||
allow-advancement-grant: true
|
||||
allow-flight: false
|
||||
allow-weather: true
|
||||
anchor-respawn: true
|
||||
auto-heal: true
|
||||
auto-load: true
|
||||
bed-respawn: true
|
||||
difficulty: normal
|
||||
entry-fee:
|
||||
enabled: false
|
||||
amount: 0.0
|
||||
currency: '@vault-economy'
|
||||
environment: nether
|
||||
gamemode: survival
|
||||
biome: ''
|
||||
generator: ''
|
||||
hidden: false
|
||||
hunger: true
|
||||
keep-spawn-in-memory: true
|
||||
player-limit: -1
|
||||
portal-form: all
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVSpawnLocation
|
||||
x: -64.0
|
||||
y: 64.0
|
||||
z: 48.0
|
||||
pitch: 0.0
|
||||
yaw: 0.0
|
||||
spawning:
|
||||
monster:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_animal:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
water_underground_creature:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
ambient:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
axolotl:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
misc:
|
||||
exceptions: [ ]
|
||||
spawn: true
|
||||
spawn-limit: '@unset'
|
||||
tick-rate: '@unset'
|
||||
world-blacklist: []
|
||||
version: 1.2
|
||||
Reference in new issue
Block a user