Update dependencies and improve configuration management
- Updated LoLib dependency to version 3.0.0 in build.gradle.kts - Added HikariCP and MySQL connector dependencies for improved database handling - Enhanced jar minimization process to exclude JDBC pool and driver - Refactored configuration management by introducing ConfigAccessor and ConfigLoader for better file handling and validation - Removed deprecated GenerationOptions class and integrated its functionality into the new structure - Improved command error handling and added cooldown hints for admin commands
This commit is contained in:
parent
978f739045
commit
3100c53229
86 changed files with 4324 additions and 3248 deletions
|
|
@ -8,7 +8,6 @@ import org.mockito.Mock;
|
|||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Unit tests for JumpValidator.
|
||||
|
|
@ -104,9 +103,9 @@ class JumpValidatorTest {
|
|||
// Diagonal jump - 3 blocks X, 2 blocks Z, same height
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 3, 100, 2);
|
||||
|
||||
double distance = Math.sqrt(3*3 + 2*2); // ~3.6 blocks
|
||||
assertTrue(validator.canJump(from, to), "Diagonal jump of ~3.6 blocks should be possible");
|
||||
|
||||
assertTrue(validator.canJump(from, to),
|
||||
"Diagonal jump of ~" + Math.sqrt(3 * 3 + 2 * 2) + " blocks should be possible");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
25
src/test/java/dev/loki/loparkour/style/RandomStyleTest.java
Normal file
25
src/test/java/dev/loki/loparkour/style/RandomStyleTest.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package dev.loki.loparkour.style;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
class RandomStyleTest {
|
||||
|
||||
@Test
|
||||
void emptyMaterialListFallsBackToStone() {
|
||||
RandomStyle style = new RandomStyle("test", Collections.emptyList());
|
||||
assertEquals(Material.STONE, style.getNext());
|
||||
}
|
||||
|
||||
@Test
|
||||
void copiesListAndReturnsOnlyDeclaredMaterials() {
|
||||
RandomStyle style = new RandomStyle("x", List.of(Material.OAK_PLANKS));
|
||||
assertSame(Material.OAK_PLANKS, style.getNext());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package dev.loki.loparkour.world;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class WorldNameValidationTest {
|
||||
|
||||
@Test
|
||||
void allowsSafeFolderNames() {
|
||||
assertTrue(World.isValidWorldFolderName("parkour"));
|
||||
assertTrue(World.isValidWorldFolderName("lp_world"));
|
||||
assertTrue(World.isValidWorldFolderName("a1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsPathTraversalAndSeparators() {
|
||||
assertFalse(World.isValidWorldFolderName("../etc"));
|
||||
assertFalse(World.isValidWorldFolderName("a/b"));
|
||||
assertFalse(World.isValidWorldFolderName("a\\b"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsBlankOrTooLong() {
|
||||
assertFalse(World.isValidWorldFolderName(""));
|
||||
assertFalse(World.isValidWorldFolderName(" "));
|
||||
assertFalse(World.isValidWorldFolderName("x".repeat(65)));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue