mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Add basic test
This commit is contained in:
parent
c42140a45a
commit
2008b41b09
3 changed files with 114 additions and 3 deletions
|
|
@ -28,7 +28,9 @@ dependencies {
|
||||||
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
|
||||||
|
|
||||||
// Gui library
|
// Gui library
|
||||||
implementation("com.github.stefvanschie.inventoryframework:IF:0.10.17")
|
val stefvanschie_IF = "com.github.stefvanschie.inventoryframework:IF:0.10.17"
|
||||||
|
implementation(stefvanschie_IF)
|
||||||
|
testRuntimeOnly(stefvanschie_IF)
|
||||||
|
|
||||||
// EnchantsSquaredRewritten
|
// EnchantsSquaredRewritten
|
||||||
compileOnly(files("libs/EnchantsSquared.jar"))
|
compileOnly(files("libs/EnchantsSquared.jar"))
|
||||||
|
|
@ -61,6 +63,10 @@ dependencies {
|
||||||
|
|
||||||
// include kotlin for the offline jar
|
// include kotlin for the offline jar
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|
||||||
|
// Test dependency
|
||||||
|
testImplementation("com.github.seeseemelk:MockBukkit-v1.21:3.133.2")
|
||||||
|
testRuntimeOnly("commons-lang:commons-lang:2.6")
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
@ -80,7 +86,7 @@ allprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(kotlin("stdlib"))
|
compileOnly(kotlin("stdlib"))
|
||||||
|
|
||||||
// Currently not used. but it would be useful to test.
|
// Test dependency
|
||||||
testImplementation(platform("org.junit:junit-bom:5.9.1"))
|
testImplementation(platform("org.junit:junit-bom:5.9.1"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +98,7 @@ allprojects {
|
||||||
// Configure used version of kotlin and java
|
// Configure used version of kotlin and java
|
||||||
java {
|
java {
|
||||||
disableAutoTargetJvm()
|
disableAutoTargetJvm()
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(20))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set target version
|
// Set target version
|
||||||
|
|
|
||||||
44
src/test/java/io/delilaheve/CustomAnvilTests.java
Normal file
44
src/test/java/io/delilaheve/CustomAnvilTests.java
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
package io.delilaheve;
|
||||||
|
|
||||||
|
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||||
|
import be.seeseemelk.mockbukkit.ServerMock;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class CustomAnvilTests {
|
||||||
|
|
||||||
|
private ServerMock server;
|
||||||
|
|
||||||
|
private CustomAnvil plugin;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
|
||||||
|
// Start the mock server
|
||||||
|
server = MockBukkit.mock();
|
||||||
|
|
||||||
|
// Load your plugin
|
||||||
|
plugin = MockBukkit.load(CustomAnvil.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown() {
|
||||||
|
// Stop the mock server
|
||||||
|
MockBukkit.unmock();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void simpleInitTest() {
|
||||||
|
// Continue initialization of the plugin
|
||||||
|
server.getScheduler().performOneTick();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
61
src/test/resources/plugin.yml
Normal file
61
src/test/resources/plugin.yml
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
main: io.delilaheve.CustomAnvil
|
||||||
|
name: CustomAnvil
|
||||||
|
prefix: "Custom Anvil"
|
||||||
|
version: ${version}
|
||||||
|
folia-supported: true
|
||||||
|
description: Allow to customise anvil mechanics
|
||||||
|
api-version: 1.16
|
||||||
|
load: POSTWORLD
|
||||||
|
authors: [ DelilahEve, alexcrea ]
|
||||||
|
libraries:
|
||||||
|
- org.jetbrains.kotlin:kotlin-stdlib:2.0.21
|
||||||
|
|
||||||
|
commands:
|
||||||
|
anvilconfigreload:
|
||||||
|
description: Reload every config of this plugin
|
||||||
|
permission: ca.command.reload
|
||||||
|
aliases:
|
||||||
|
#- acreload # anvil config reload
|
||||||
|
#- careload # custom anvil reload
|
||||||
|
- carl # custom anvil reload
|
||||||
|
customanvilconfig:
|
||||||
|
description: open a menu for administrator to edit plugin's config in game
|
||||||
|
permission: ca.config.edit
|
||||||
|
aliases:
|
||||||
|
- configanvil
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
ca.affected:
|
||||||
|
default: true
|
||||||
|
description: Player with this permission will be affected by the plugin
|
||||||
|
ca.bypass.fuse:
|
||||||
|
default: false
|
||||||
|
description: Allow player to combine every enchantments to every item (no custom limit)
|
||||||
|
ca.bypass.level:
|
||||||
|
default: false
|
||||||
|
description: Allow player to bypass every level limit (no custom limit)
|
||||||
|
ca.command.reload:
|
||||||
|
default: op
|
||||||
|
description: Allow administrator to reload the plugin's configs
|
||||||
|
ca.config.edit:
|
||||||
|
default: op
|
||||||
|
description: Allow administrator to edit the plugin's config in game
|
||||||
|
# color permissions
|
||||||
|
ca.color.code:
|
||||||
|
default: op
|
||||||
|
description: Allow player to use color code if permission is required (toggleable)
|
||||||
|
ca.color.hex:
|
||||||
|
default: op
|
||||||
|
description: Allow player to use hexadecimal color if permission is required (toggleable)
|
||||||
|
|
||||||
|
|
||||||
|
# soft depend on old name (UnsafeEnchantsPlus), so I can disable it if it is on the same server (old name for this plugin)
|
||||||
|
# Also depend to other plugin for compatibility
|
||||||
|
softdepend:
|
||||||
|
- UnsafeEnchantsPlus
|
||||||
|
- ProtocolLib
|
||||||
|
- Disenchantment
|
||||||
|
- EnchantsSquared
|
||||||
|
- EcoEnchants
|
||||||
|
- eco
|
||||||
|
- ExcellentEnchants
|
||||||
Loading…
Add table
Add a link
Reference in a new issue