build: establish Tree Feller project

This commit is contained in:
dmg
2026-08-11 17:10:33 -04:00
parent de27d6519e
commit 39fb3cfc57
15 changed files with 664 additions and 7 deletions
@@ -0,0 +1,11 @@
package games.dmg.treefeller;
import org.bukkit.plugin.java.JavaPlugin;
/** Entry point for Tree Feller. */
public final class TreeFellerPlugin extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
}
}
+1
View File
@@ -0,0 +1 @@
# Tree Feller settings are introduced and validated by US-008.
+25
View File
@@ -0,0 +1,25 @@
name: TreeFeller
version: ${version}
main: games.dmg.treefeller.TreeFellerPlugin
api-version: "1.20"
description: Earn and use safe, animated tree felling by species.
author: dmg.games
commands:
treefeller:
description: Control personal tree felling and inspect unlocks.
usage: /treefeller <enabled|unlocked|undo>
permission: treefeller.command
treefelleradmin:
description: Administer Tree Feller players and thresholds.
usage: /treefelleradmin <player|threshold>
permission: treefeller.admin
permissions:
treefeller.command:
description: Allows access to Tree Feller player commands.
default: true
treefeller.undo:
description: Allows a player to undo their latest felling.
default: true
treefeller.admin:
description: Allows administration of Tree Feller.
default: op
@@ -0,0 +1,37 @@
package games.dmg.treefeller;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.Yaml;
class PluginMetadataTest {
@Test
void declaresSeparatePlayerAndAdministrativeCommands() throws IOException {
Map<String, Object> metadata = loadMetadata();
assertEquals("TreeFeller", metadata.get("name"));
assertEquals("games.dmg.treefeller.TreeFellerPlugin", metadata.get("main"));
Map<?, ?> commands = (Map<?, ?>) metadata.get("commands");
assertNotNull(commands.get("treefeller"));
assertNotNull(commands.get("treefelleradmin"));
Map<?, ?> playerCommand = (Map<?, ?>) commands.get("treefeller");
Map<?, ?> adminCommand = (Map<?, ?>) commands.get("treefelleradmin");
assertEquals("treefeller.command", playerCommand.get("permission"));
assertEquals("treefeller.admin", adminCommand.get("permission"));
assertNotSame(playerCommand.get("permission"), adminCommand.get("permission"));
}
private Map<String, Object> loadMetadata() throws IOException {
try (InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml")) {
assertNotNull(stream, "plugin.yml must be available on the test classpath");
return new Yaml().load(stream);
}
}
}