Skip to content

Commit dbab198

Browse files
committed
Dump commands to separate file
1 parent 242bc7d commit dbab198

File tree

5 files changed

+55
-64
lines changed

5 files changed

+55
-64
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.4.5] - 2025-11-15
910
### Added
1011
- Simple `/repair` command
1112

COMMANDS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
| Command | Alias | Permission | Default |
2+
|---|---|---|---|
3+
| `/anvil` | | `fabric-essentials.command.anvil` ||
4+
| `/cartographytable` | | `fabric-essentials.command.cartographytable` ||
5+
| `/enchantment` | | `fabric-essentials.command.enchantment` ||
6+
| `/enderchest` | `/ec` | `fabric-essentials.command.enderchest` ||
7+
| `/grindstone` | | `fabric-essentials.command.grindstone` ||
8+
| `/loom` | | `fabric-essentials.command.loom` ||
9+
| `/smithing` | | `fabric-essentials.command.smithing` ||
10+
| `/stonecutter` | | `fabric-essentials.command.stonecutter` ||
11+
| `/workbench` | `/craft`, `/wb` | `fabric-essentials.command.workbench` ||
12+
| `/deletehome [<home>] [<player>]` | `/delhome`, `/removehome` | `fabric-essentials.command.deletehome` ||
13+
| `/home [<home>] [<player>]` | | `fabric-essentials.command.home` ||
14+
| `/homes [<player>]` | | `fabric-essentials.command.homes` ||
15+
| `/sethome [<home>] [<player>\|-confirm]` | | `fabric-essentials.command.sethome` ||
16+
| `/deletewarp <warp>` | `/delwarp` | `fabric-essentials.command.deletewarp` ||
17+
| `/warp <warp>` | | `fabric-essentials.command.warp` ||
18+
| `/setwarp <warp>` | | `fabric-essentials.command.setwarp` ||
19+
| `/warps` | | `fabric-essentials.command.warps` ||
20+
| `/tpa <target>` | `/tpr` | `fabric-essentials.command.tpa` ||
21+
| `/tpahere <target>` | `/tprhere` | `fabric-essentials.command.tpahere` ||
22+
| `/tpall` | | `fabric-essentials.command.tpall` ||
23+
| `/tpaccept [<target>]` | | `fabric-essentials.command.tpaccept` ||
24+
| `/tpdeny [<target>]` | | `fabric-essentials.command.tpdeny` ||
25+
| `/back` | | `fabric-essentials.command.back` ||
26+
| `/broadcast <message>` | | `fabric-essentials.command.broadcast` ||
27+
| `/commandspy` | | `fabric-essentials.command.commandspy` ||
28+
| `/essentials reload`, `/essentials import <importer>` | | `fabric-essentials.command.essentials` ||
29+
| `/feed [<player>]` | | `fabric-essentials.command.feed` ||
30+
| `/hat` | | `fabric-essentials.command.hat` ||
31+
| `/itemedit name (<name>\|clear)`, `/itemedit lore <line> (<lore>\|clear)` | | `fabric-essentials.command.itemedit` ||
32+
| `/heal [<player>]` | | `fabric-essentials.command.heal` ||
33+
| `/glow [<player>]` | | `fabric-essentials.command.glow` ||
34+
| `/ping [<player>]` | | `fabric-essentials.command.ping` ||
35+
| `/repair [all]` | | `fabric-essentials.command.repair` ||
36+
| `/signedit <line> (<text>\|clear)` | | `fabric-essentials.command.signedit` ||
37+
| `/mods [<mod>]` | | `fabric-essentials.command.mods` ||
38+
| `/fly [<player>]` | | `fabric-essentials.command.fly` ||
39+
| `/flyspeed [<flyspeed>] [<target>]` | | `fabric-essentials.command.flyspeed` ||
40+
| `/walkspeed [<walkspeed>] [<target>]` | | `fabric-essentials.command.walkspeed` ||
41+
| `/invulnerable [<player>]` | `/godmode` | `fabric-essentials.command.invulnerable` ||
42+
| `/tellmessage <targets> <message>` | | `fabric-essentials.command.tellmessage` ||
43+
| `/message-to-vanilla quicktext <message>`, `/message-to-vanilla simplifiedtext <message>` | | `fabric-essentials.command.message-to-vanilla` ||

README.md

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,7 @@
11
# Fabric Essentials
22

33
## Commands
4-
5-
| Command | Alias | Permission | Default |
6-
|-------------------------------------------------------------------------------------------|---------------------------|------------------------------------------------|---------|
7-
| `/anvil` | | `fabric-essentials.command.anvil` ||
8-
| `/cartographytable` | | `fabric-essentials.command.cartographytable` ||
9-
| `/enchantment` | | `fabric-essentials.command.enchantment` ||
10-
| `/enderchest` | `/ec` | `fabric-essentials.command.enderchest` ||
11-
| `/grindstone` | | `fabric-essentials.command.grindstone` ||
12-
| `/loom` | | `fabric-essentials.command.loom` ||
13-
| `/smithing` | | `fabric-essentials.command.smithing` ||
14-
| `/stonecutter` | | `fabric-essentials.command.stonecutter` ||
15-
| `/workbench` | `/craft`, `/wb` | `fabric-essentials.command.workbench` ||
16-
| `/deletehome [<home>] [<player>]` | `/delhome`, `/removehome` | `fabric-essentials.command.deletehome` ||
17-
| `/home [<home>] [<player>]` | | `fabric-essentials.command.home` ||
18-
| `/homes [<player>]` | | `fabric-essentials.command.homes` ||
19-
| `/sethome [<home>] [<player>\|-confirm]` | | `fabric-essentials.command.sethome` ||
20-
| `/deletewarp <warp>` | `/delwarp` | `fabric-essentials.command.deletewarp` ||
21-
| `/warp <warp>` | | `fabric-essentials.command.warp` ||
22-
| `/setwarp <warp>` | | `fabric-essentials.command.setwarp` ||
23-
| `/warps` | | `fabric-essentials.command.warps` ||
24-
| `/tpa <target>` | `/tpr` | `fabric-essentials.command.tpa` ||
25-
| `/tpahere <target>` | `/tprhere` | `fabric-essentials.command.tpahere` ||
26-
| `/tpall` | | `fabric-essentials.command.tpall` ||
27-
| `/tpaccept <target>` | | `fabric-essentials.command.tpaccept` ||
28-
| `/tpdeny <target>` | | `fabric-essentials.command.tpdeny` ||
29-
| `/back` | | `fabric-essentials.command.back` ||
30-
| `/broadcast <message>` | | `fabric-essentials.command.broadcast` ||
31-
| `/commandspy` | | `fabric-essentials.command.commandspy` ||
32-
| `/essentials reload`, `/essentials import <importer>` | | `fabric-essentials.command.essentials` ||
33-
| `/feed [<player>]` | | `fabric-essentials.command.feed` ||
34-
| `/hat` | | `fabric-essentials.command.hat` ||
35-
| `/itemedit name (<name>\|clear)`, `/itemedit lore <line> (<lore>\|clear)` | | `fabric-essentials.command.itemedit` ||
36-
| `/heal [<player>]` | | `fabric-essentials.command.heal` ||
37-
| `/glow [<player>]` | | `fabric-essentials.command.glow` ||
38-
| `/ping [<player>]` | | `fabric-essentials.command.ping` ||
39-
| `/signedit <line> (<text>\|clear)` | | `fabric-essentials.command.signedit` ||
40-
| `/mods [<mod>]` | | `fabric-essentials.command.mods` ||
41-
| `/fly [<player>]` | | `fabric-essentials.command.fly` ||
42-
| `/flyspeed [<flyspeed>] [<target>]` | | `fabric-essentials.command.flyspeed` ||
43-
| `/walkspeed [<walkspeed>] [<target>]` | | `fabric-essentials.command.walkspeed` ||
44-
| `/invulnerable [<player>]` | `/godmode` | `fabric-essentials.command.invulnerable` ||
45-
| `/tellmessage <targets> <message>` | | `fabric-essentials.command.tellmessage` ||
46-
| `/message-to-vanilla quicktext <message>`, `/message-to-vanilla simplifiedtext <message>` | | `fabric-essentials.command.message-to-vanilla` ||
4+
This mod adds a lot of commands to Minecraft. Check out [COMMANDS.md](https://github.com/DrexHD/FabricEssentials/blob/main/COMMANDS.md) for a full list.
475

486
## Config
497
```json5

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ modrinth_minecraft_versions=[VERSIONED]
88
java_version=[VERSIONED]
99
loader_version=0.17.3
1010
# Mod Properties
11-
mod_version=1.4.4
11+
mod_version=1.4.5
1212
maven_group=me.drex
1313
archives_base_name=fabric-essentials
1414
# Dependencies

src/main/java/me/drex/essentials/command/CommandManager.java

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import me.drex.essentials.command.impl.menu.*;
88
import me.drex.essentials.command.impl.misc.*;
99
import me.drex.essentials.command.impl.misc.admin.*;
10+
import net.fabricmc.loader.api.FabricLoader;
1011
import net.minecraft.commands.CommandBuildContext;
1112
import net.minecraft.commands.CommandSourceStack;
1213
import net.minecraft.commands.Commands;
@@ -25,6 +26,8 @@
2526
import me.drex.essentials.command.impl.warp.WarpCommand;
2627
import me.drex.essentials.command.impl.warp.WarpsCommand;
2728

29+
import java.io.IOException;
30+
import java.nio.file.Files;
2831
import java.util.Arrays;
2932
import java.util.Map;
3033

@@ -88,27 +91,9 @@ public CommandManager(CommandDispatcher<CommandSourceStack> dispatcher, CommandB
8891
}
8992

9093
public static void dumpCommands(CommandDispatcher<CommandSourceStack> dispatcher, MinecraftServer server) {
91-
if (!DUMP_COMMANDS) return;
94+
if (!FabricLoader.getInstance().isDevelopmentEnvironment()) return;
9295
var source = server.createCommandSourceStack();
9396

94-
String simple = String.join(", ", Arrays.stream(COMMANDS).map(command -> {
95-
var properties = command.commandProperties;
96-
ParseResults<CommandSourceStack> parseResults = dispatcher.parse(properties.literal(), source);
97-
Map<CommandNode<CommandSourceStack>, String> map = dispatcher.getSmartUsage((Iterables.getLast(parseResults.getContext().getNodes())).getNode(), source);
98-
if (map.isEmpty()) {
99-
return "`/" + properties.literal() + "`";
100-
} else {
101-
return String.join(
102-
", ",
103-
map.values().stream()
104-
.map(s -> "`/" + properties.literal() + " " + s.replace("|", "\\|") + "`")
105-
.toList()
106-
);
107-
108-
}
109-
}).toList());
110-
System.out.println(simple);
111-
11297
StringBuilder builder = new StringBuilder();
11398
builder
11499
.append("| Command | Alias | Permission | Default |\n")
@@ -149,7 +134,11 @@ public static void dumpCommands(CommandDispatcher<CommandSourceStack> dispatcher
149134
}
150135
builder.append(" |\n");
151136
}
152-
System.out.println(builder);
137+
try {
138+
Files.write(FabricLoader.getInstance().getGameDir().getParent().getParent().getParent().resolve("COMMANDS.md"), builder.toString().getBytes());
139+
} catch (IOException e) {
140+
throw new RuntimeException(e);
141+
}
153142
}
154143

155144
}

0 commit comments

Comments
 (0)