Skip to content

Commit 3cc9810

Browse files
committed
Bugfix /invsee bad permission, added /craft alias to /workbench.
1 parent 9973981 commit 3cc9810

4 files changed

Lines changed: 21 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# v0.3.1-alpha
2+
3+
- Bugfix wrong permission node `solstice.command.invsee.exempt`.
4+
- Added `/craft` alias to `/workbench`.
5+
6+
# v0.3.0-alpha
7+
18
- Added many utility commands to open various blocks GUIs:
29
- Anvil - `/anvil`
310
- Cartography table - `/cartography`

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10
99
loader_version=0.16.9
1010

1111
# Mod Properties
12-
mod_version=0.3.0-alpha
12+
mod_version=0.3.1-alpha
1313
maven_group=me.alexdevs
1414
archives_base_name=solstice
1515

src/main/java/me/alexdevs/solstice/commands/utilities/InventorySeeCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
2323
var player = source.getPlayerOrThrow();
2424
var target = EntityArgumentType.getPlayer(context, "player");
2525

26-
if (Permissions.check(target, "solstice.command.exempt", 3)) {
26+
if (Permissions.check(target, "solstice.command.invsee.exempt", 3)) {
2727
source.sendError(Text.of("You cannot open this inventory because the player is exempt."));
2828
return 0;
2929
}

src/main/java/me/alexdevs/solstice/commands/utilities/WorkbenchCommand.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.alexdevs.solstice.commands.utilities;
22

33
import com.mojang.brigadier.CommandDispatcher;
4+
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
45
import me.lucko.fabric.api.permissions.v0.Permissions;
56
import net.minecraft.screen.CraftingScreenHandler;
67
import net.minecraft.screen.ScreenHandlerContext;
@@ -9,12 +10,21 @@
910
import net.minecraft.stat.Stats;
1011
import net.minecraft.text.Text;
1112

13+
import java.util.function.Predicate;
14+
1215
import static net.minecraft.server.command.CommandManager.literal;
1316

1417
public class WorkbenchCommand {
18+
private static final Predicate<ServerCommandSource> requirement = Permissions.require("solstice.command.workbench", 2);
19+
1520
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
16-
var rootCommand = literal("workbench")
17-
.requires(Permissions.require("solstice.command.workbench", 2))
21+
dispatcher.register(command("workbench"));
22+
dispatcher.register(command("craft"));
23+
}
24+
25+
private static LiteralArgumentBuilder<ServerCommandSource> command(String command) {
26+
return literal(command)
27+
.requires(requirement)
1828
.executes(context -> {
1929
var player = context.getSource().getPlayerOrThrow();
2030
var screen = new SimpleNamedScreenHandlerFactory(
@@ -26,7 +36,5 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
2636

2737
return 1;
2838
});
29-
30-
dispatcher.register(rootCommand);
3139
}
3240
}

0 commit comments

Comments
 (0)