Skip to content

Commit

Permalink
Move captions
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Jan 15, 2024
1 parent 83138e1 commit 88cba9a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import cloud.commandframework.exceptions.NoPermissionException;
import cloud.commandframework.exceptions.NoSuchCommandException;
import cloud.commandframework.execution.ExecutionCoordinator;
import cloud.commandframework.minecraft.modded.ModdedCaptionRegistry;
import cloud.commandframework.minecraft.modded.internal.ModdedParserMappings;
import cloud.commandframework.minecraft.modded.internal.ModdedPreprocessor;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
Expand Down Expand Up @@ -133,7 +134,7 @@ public abstract class FabricCommandManager<C, S extends SharedSuggestionProvider
);

ModdedParserMappings.register(this, this.brigadierManager);
this.captionRegistry(new FabricCaptionRegistry<>());
this.captionRegistry(new ModdedCaptionRegistry<>());
this.registerCommandPreProcessor(new ModdedPreprocessor<>(senderMapper));

((FabricCommandRegistrationHandler<C, S>) this.commandRegistrationHandler()).initialize(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.checkerframework.checker.nullness.qual.NonNull;

/**
* {@link Caption} instances for messages in cloud-fabric
* {@link Caption} instances for messages in cloud-modded-minecraft-common
*/
public final class ModdedCaptionKeys {

Expand Down Expand Up @@ -62,7 +62,6 @@ private ModdedCaptionKeys() {
* Get an immutable collection containing all standard caption keys
*
* @return Immutable collection of keys
* @since 1.5.0
*/
public static @NonNull Collection<@NonNull Caption> moddedCaptionKeys() {
return Collections.unmodifiableCollection(RECOGNIZED_CAPTIONS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,30 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
package cloud.commandframework.fabric;
package cloud.commandframework.minecraft.modded;

import cloud.commandframework.captions.CaptionProvider;
import cloud.commandframework.captions.StandardCaptionRegistry;
import cloud.commandframework.minecraft.modded.ModdedCaptionKeys;

/**
* Caption registry that uses bi-functions to produce messages.
*
* @param <C> Command sender type
* @since 1.5.0
* @param <C> command sender type
*/
public class FabricCaptionRegistry<C> extends StandardCaptionRegistry<C> {
public class ModdedCaptionRegistry<C> extends StandardCaptionRegistry<C> {

/**
* Default caption for {@link ModdedCaptionKeys#ARGUMENT_PARSE_FAILURE_REGISTRY_ENTRY_UNKNOWN_ENTRY}
*
* @since 1.5.0
*/
public static final String ARGUMENT_PARSE_FAILURE_REGISTRY_ENTRY_UNKNOWN_ENTRY =
"Could not find value with key '<id>' in registry '<registry>'.";

/**
* Default caption for {@link ModdedCaptionKeys#ARGUMENT_PARSE_FAILURE_TEAM_UNKNOWN}
*
* @since 1.5.0
*/
public static final String ARGUMENT_PARSE_FAILURE_TEAM_UNKNOWN = "Could not find any team named '<input>'!";

protected FabricCaptionRegistry() {
public ModdedCaptionRegistry() {
super();

this.registerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import cloud.commandframework.execution.ExecutionCoordinator;
import cloud.commandframework.meta.CommandMeta;
import cloud.commandframework.meta.SimpleCommandMeta;
import cloud.commandframework.minecraft.modded.ModdedCaptionRegistry;
import cloud.commandframework.minecraft.modded.ModdedCommandContextKeys;
import cloud.commandframework.minecraft.modded.internal.ModdedParserMappings;
import cloud.commandframework.minecraft.modded.internal.ModdedPreprocessor;
Expand Down Expand Up @@ -100,6 +101,7 @@ protected NeoForgeCommandManager(
), senderMapper);
this.registerDefaultExceptionHandlers();
registrationHandler.initialize(this);
this.captionRegistry(new ModdedCaptionRegistry<>());
this.registerCommandPreProcessor(new ModdedPreprocessor<>(senderMapper));

ModdedParserMappings.register(this, this.brigadierManager);
Expand Down

0 comments on commit 88cba9a

Please sign in to comment.