Skip to content

Commit

Permalink
Register Locki's command argument types
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed May 17, 2021
1 parent c604010 commit a4e9078
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
------------------------------------------------------
Version 0.1.1
------------------------------------------------------
**Fixes**
- Locki's command argument types are now properly registered

------------------------------------------------------
Version 0.1.0
------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.3

# Mod Properties
mod_version = 0.1.0
mod_version = 0.1.1
maven_group = io.github.ladysnake
archives_base_name = locki

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/io/github/ladysnake/locki/Locki.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import io.github.ladysnake.locki.impl.LockiCommand;
import io.github.ladysnake.locki.impl.InventoryLockArgumentType;
import io.github.ladysnake.locki.impl.InventoryNodeArgumentType;
import me.lucko.fabric.api.permissions.v0.PermissionCheckEvent;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.util.TriState;
import net.minecraft.command.argument.ArgumentTypes;
import net.minecraft.command.argument.serialize.ConstantArgumentSerializer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.command.ServerCommandSource;
Expand Down Expand Up @@ -132,6 +136,8 @@ public static Stream<String> streamNodeNames() {
public void onInitialize() {
DefaultInventoryNodes.init();

ArgumentTypes.register("locki:inventory_lock", InventoryLockArgumentType.class, new ConstantArgumentSerializer<>(InventoryLockArgumentType::inventoryLock));
ArgumentTypes.register("locki:inventory_node", InventoryNodeArgumentType.class, new ConstantArgumentSerializer<>(InventoryNodeArgumentType::inventoryNode));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> LockiCommand.register(dispatcher));
PermissionCheckEvent.EVENT.register((source, permission) -> {
if (source instanceof ServerCommandSource && permission.startsWith("locki.access.")) {
Expand Down

0 comments on commit a4e9078

Please sign in to comment.