Skip to content

Commit

Permalink
Add brigadier mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimordialMoros committed Feb 23, 2024
1 parent 9d5d711 commit 824b0c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 0 additions & 3 deletions common/src/main/resources/bending/lang/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ bending.gui.elements.display=Right click to list all abilities
bending.gui.elements.add=Shift-left click to add
bending.gui.elements.remove=Shift-right click to remove
# Activation methods
bending.activation.tap=Tap {0}
bending.activation.hold=Hold {0}
bending.activation.release=Release {0}
bending.activation.attack=Attack
bending.activation.interact=Right Click Air
bending.activation.interact-entity=Right Click Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import me.moros.bending.api.util.functional.Suppliers;
import me.moros.bending.common.AbstractBending;
import me.moros.bending.common.command.Commander;
import me.moros.bending.common.command.parser.AbilityParser;
import me.moros.bending.common.hook.MiniPlaceholdersHook;
import me.moros.bending.common.logging.Slf4jLogger;
import me.moros.bending.common.util.Initializer;
Expand All @@ -56,8 +57,8 @@
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.metadata.Person;
import net.minecraft.commands.arguments.ResourceLocationArgument;
import net.minecraft.server.MinecraftServer;
import org.incendo.cloud.CommandManager;
import org.incendo.cloud.SenderMapper;
import org.incendo.cloud.execution.ExecutionCoordinator;
import org.incendo.cloud.fabric.FabricServerCommandManager;
Expand All @@ -83,10 +84,14 @@ final class FabricBending extends AbstractBending<ModContainer> {
);
registerLifecycleListeners();

CommandManager<CommandSender> manager = new FabricServerCommandManager<>(
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
ExecutionCoordinator.simpleCoordinator(),
SenderMapper.create(CommandSender::from, CommandSender::stack)
);
manager.brigadierManager().registerMapping(
new io.leangen.geantyref.TypeToken<AbilityParser<CommandSender>>() {},
builder -> builder.toConstant(ResourceLocationArgument.id()).cloudSuggestions()
);
Commander.create(manager, PlayerCommandSender.class, this).init();
}

Expand Down

0 comments on commit 824b0c0

Please sign in to comment.