Jump to content

SPDE

Members
  • Posts

    7
  • Joined

  • Last visited

SPDE's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. As I said, the server I'm playing on is running on 1.16.5 and can't be updated because the modpack is limited to that version and probably won't be updated for a few years.
  2. I could add the commands with ClientChatEvent, but is there any way to implement something like a custom autocomplete?
  3. Well, that’s unfortunate. I have good relations to the management, what would the server need to do that the commands would work?
  4. The server I'm playing on only runs on 1.16.5 because the modpack is limited to that version, is there nothing else that can be done?
  5. As I said, it works in singleplayer, it just doesn't work on multiplayer servers, but sure: One of the commands. package com.versemod.command.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.versemod.command.Command; import com.versemod.configs.GeneralConfig; import com.versemod.util.MessageBus; import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; @Command.Declaration(name="Token Calculation",syntax = VerseModCommands.COMMAND_SYNTAX_PREFIX+" tc",description = "Calculates token value") public class TokenCalculationCommand extends Command { private static final GeneralConfig config = new GeneralConfig(); private static final TokenCalculationCommand tokenCommand = new TokenCalculationCommand(); /* * Used by VerseModCommands to register the TokenCalculation command. * */ protected static ArgumentBuilder<CommandSource,?> register() { VerseModCommands.addCommand(tokenCommand); return Commands.literal("tc").executes(cmd->VerseModCommands.throwSyntaxHelp(tokenCommand,"<amount>")) .then(Commands.argument("amount", IntegerArgumentType.integer(1)) .executes(command->calculateTokenValue(IntegerArgumentType.getInteger(command,"amount"))) ); } /* * Calculates the token amount value based on the GeneralConfig defined token value. * */ private static int calculateTokenValue(int amount){ int valuePerToken = config.getTokenValue(); MessageBus.sendPlayerMessage(MessageBus.DEFAULT_HIGHLIGHT_COLOR+""+amount +""+ MessageBus.DEFAULT_SUCCESS_COLOR+ " token(s) are worth "+MessageBus.DEFAULT_HIGHLIGHT_COLOR+"$" + valuePerToken * amount,true); return -1; } } Registration: /* * Registers all VerseMod commands. * */ @SubscribeEvent public void registerCommands(RegisterCommandsEvent event) { event.getDispatcher().register( LiteralArgumentBuilder.<CommandSource> literal(COMMAND_PREFIX).executes(cmd->HelpCommand.getHelp()) .then(HelpCommand.register()) .then(TokenCalculationCommand.register()) .then(TrackCommand.register()) .then(HologramCommand.register()) .then(FormattingCommand.register()) .then(WeeklyEventCommand.register()) .then(ItemBindCommand.register()) .then(PunishmentCommand.register()) .then(HostBroadcastCommand.register()) ); }
  6. It returns the default message "Unknown or incomplete command" and is also unable to auto-complete if that is what you mean.
  7. Hello I've almost finished my first mod, which is basically just a little add-on mod to Vanilla(e.g. A command where I type something into the chat with color codes and then the client sends it back to me as a formatted string, so I can see if there are issues before I use it for server stuff), but now when I went to try it out for the first time on a multiplayer server, I found that I can't use any of the commands I registered with the RegisterCommandsEvent that worked in singleplayer. Is there any way to register the commands on the client side so that they work for me in multiplayer?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.