Renamed project to 'Brigadier'

This commit is contained in:
Nathan Adams
2014-10-02 13:00:29 +02:00
parent 8c5338a6bd
commit ef4199e824
42 changed files with 134 additions and 134 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ apply plugin: 'maven'
apply plugin: 'eclipse' apply plugin: 'eclipse'
version = '0.0.1' version = '0.0.1'
archivesBaseName = 'minecraft-commands' archivesBaseName = 'brigadier'
group = 'com.mojang' group = 'com.mojang'
sourceCompatibility = 1.6 sourceCompatibility = 1.6
@@ -61,8 +61,8 @@ uploadArchives {
repository(url: "file://" + repoDir.absolutePath) repository(url: "file://" + repoDir.absolutePath)
pom.project { pom.project {
description 'Minecraft Command Handler' description 'Command Registration & Dispatch System'
url 'http://github.com/Mojang/minecraft-commands' url 'http://github.com/Mojang/brigadier'
} }
} }
} }
@@ -0,0 +1,7 @@
package com.mojang.brigadier;
import com.mojang.brigadier.context.CommandContext;
public interface Command {
void run(CommandContext context);
}
@@ -1,12 +1,12 @@
package net.minecraft.commands; package com.mojang.brigadier;
import net.minecraft.commands.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.commands.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import net.minecraft.commands.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.commands.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
import net.minecraft.commands.tree.RootCommandNode; import com.mojang.brigadier.tree.RootCommandNode;
public class CommandDispatcher<T> { public class CommandDispatcher<T> {
public static final SimpleCommandExceptionType ERROR_UNKNOWN_COMMAND = new SimpleCommandExceptionType("unknown_command", "Unknown command"); public static final SimpleCommandExceptionType ERROR_UNKNOWN_COMMAND = new SimpleCommandExceptionType("unknown_command", "Unknown command");
@@ -0,0 +1,8 @@
package com.mojang.brigadier.arguments;
import com.mojang.brigadier.context.ParsedArgument;
import com.mojang.brigadier.exceptions.CommandException;
public interface CommandArgumentType<T> {
ParsedArgument<T> parse(String command) throws CommandException;
}
@@ -1,11 +1,11 @@
package net.minecraft.commands.arguments; package com.mojang.brigadier.arguments;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import net.minecraft.commands.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import net.minecraft.commands.context.ParsedArgument; import com.mojang.brigadier.context.ParsedArgument;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import net.minecraft.commands.exceptions.ParameterizedCommandExceptionType; import com.mojang.brigadier.exceptions.ParameterizedCommandExceptionType;
public class IntegerArgumentType implements CommandArgumentType<Integer> { public class IntegerArgumentType implements CommandArgumentType<Integer> {
public static final ParameterizedCommandExceptionType ERROR_NOT_A_NUMBER = new ParameterizedCommandExceptionType("argument-integer-invalid", "Expected an integer, found '${found}'", "found"); public static final ParameterizedCommandExceptionType ERROR_NOT_A_NUMBER = new ParameterizedCommandExceptionType("argument-integer-invalid", "Expected an integer, found '${found}'", "found");
@@ -1,4 +1,4 @@
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
package net.minecraft.commands.context; package com.mojang.brigadier.arguments;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,8 +1,8 @@
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
import net.minecraft.commands.tree.RootCommandNode; import com.mojang.brigadier.tree.RootCommandNode;
import java.util.Collection; import java.util.Collection;
@@ -1,7 +1,7 @@
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import net.minecraft.commands.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
import net.minecraft.commands.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
public class LiteralArgumentBuilder extends ArgumentBuilder<LiteralArgumentBuilder> { public class LiteralArgumentBuilder extends ArgumentBuilder<LiteralArgumentBuilder> {
private final String literal; private final String literal;
@@ -1,8 +1,8 @@
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import net.minecraft.commands.arguments.CommandArgumentType; import com.mojang.brigadier.arguments.CommandArgumentType;
import net.minecraft.commands.tree.ArgumentCommandNode; import com.mojang.brigadier.tree.ArgumentCommandNode;
import net.minecraft.commands.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
public class RequiredArgumentBuilder<T> extends ArgumentBuilder<RequiredArgumentBuilder<T>> { public class RequiredArgumentBuilder<T> extends ArgumentBuilder<RequiredArgumentBuilder<T>> {
private final String name; private final String name;
@@ -1,4 +1,4 @@
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,7 +1,7 @@
package net.minecraft.commands.context; package com.mojang.brigadier.context;
import com.google.common.primitives.Primitives; import com.google.common.primitives.Primitives;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import java.util.Map; import java.util.Map;
@@ -1,7 +1,7 @@
package net.minecraft.commands.context; package com.mojang.brigadier.context;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import java.util.Map; import java.util.Map;
@@ -1,4 +1,4 @@
package net.minecraft.commands.context; package com.mojang.brigadier.context;
public class ParsedArgument<T> { public class ParsedArgument<T> {
private final String raw; private final String raw;
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package com.mojang.brigadier.context;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,4 +1,4 @@
package net.minecraft.commands.exceptions; package com.mojang.brigadier.exceptions;
import java.util.Map; import java.util.Map;
@@ -1,4 +1,4 @@
package net.minecraft.commands.exceptions; package com.mojang.brigadier.exceptions;
public interface CommandExceptionType { public interface CommandExceptionType {
String getTypeName(); String getTypeName();
@@ -1,4 +1,4 @@
package net.minecraft.commands.exceptions; package com.mojang.brigadier.exceptions;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@@ -1,4 +1,4 @@
package net.minecraft.commands.exceptions; package com.mojang.brigadier.exceptions;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package com.mojang.brigadier.exceptions;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,4 +1,4 @@
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
package net.minecraft.commands; package com.mojang.brigadier;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,10 +1,10 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.arguments.CommandArgumentType; import com.mojang.brigadier.arguments.CommandArgumentType;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.context.ParsedArgument; import com.mojang.brigadier.context.ParsedArgument;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
public class ArgumentCommandNode<T> extends CommandNode { public class ArgumentCommandNode<T> extends CommandNode {
private final String name; private final String name;
@@ -1,9 +1,9 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@@ -1,10 +1,10 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import net.minecraft.commands.exceptions.ParameterizedCommandExceptionType; import com.mojang.brigadier.exceptions.ParameterizedCommandExceptionType;
public class LiteralCommandNode extends CommandNode { public class LiteralCommandNode extends CommandNode {
public static final ParameterizedCommandExceptionType ERROR_INCORRECT_LITERAL = new ParameterizedCommandExceptionType("incorrect_literal", "Expected literal ${expected}", "expected"); public static final ParameterizedCommandExceptionType ERROR_INCORRECT_LITERAL = new ParameterizedCommandExceptionType("incorrect_literal", "Expected literal ${expected}", "expected");
@@ -1,7 +1,7 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
public class RootCommandNode extends CommandNode { public class RootCommandNode extends CommandNode {
public RootCommandNode() { public RootCommandNode() {
@@ -1,4 +1,4 @@
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,7 +0,0 @@
package net.minecraft.commands;
import net.minecraft.commands.context.CommandContext;
public interface Command {
void run(CommandContext context);
}
@@ -1,8 +0,0 @@
package net.minecraft.commands.arguments;
import net.minecraft.commands.context.ParsedArgument;
import net.minecraft.commands.exceptions.CommandException;
public interface CommandArgumentType<T> {
ParsedArgument<T> parse(String command) throws CommandException;
}
@@ -1,4 +0,0 @@
@ParametersAreNonnullByDefault
package net.minecraft.commands.arguments;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,4 +0,0 @@
@ParametersAreNonnullByDefault
package net.minecraft.commands.exceptions;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,16 +1,16 @@
package net.minecraft.commands; package com.mojang.brigadier;
import net.minecraft.commands.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.LiteralArgumentBuilder.literal; import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument; import static com.mojang.brigadier.builder.RequiredArgumentBuilder.argument;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
@@ -1,18 +1,18 @@
package net.minecraft.commands.arguments; package com.mojang.brigadier.arguments;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import net.minecraft.commands.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.context.ParsedArgument; import com.mojang.brigadier.context.ParsedArgument;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import net.minecraft.commands.exceptions.CommandExceptionType; import com.mojang.brigadier.exceptions.CommandExceptionType;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.util.Map; import java.util.Map;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static org.hamcrest.Matchers.hasToString; import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@@ -1,11 +1,11 @@
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import net.minecraft.commands.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument; import static com.mojang.brigadier.builder.RequiredArgumentBuilder.argument;
import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@@ -1,13 +1,13 @@
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mock; import org.mockito.Mock;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument; import static com.mojang.brigadier.builder.RequiredArgumentBuilder.argument;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@@ -1,14 +1,14 @@
package net.minecraft.commands.builder; package com.mojang.brigadier.builder;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.arguments.CommandArgumentType; import com.mojang.brigadier.arguments.CommandArgumentType;
import net.minecraft.commands.tree.ArgumentCommandNode; import com.mojang.brigadier.tree.ArgumentCommandNode;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mock; import org.mockito.Mock;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument; import static com.mojang.brigadier.builder.RequiredArgumentBuilder.argument;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@@ -1,14 +1,14 @@
package net.minecraft.commands.context; package com.mojang.brigadier.context;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@@ -1,4 +1,4 @@
package net.minecraft.commands.context; package com.mojang.brigadier.context;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import org.junit.Test; import org.junit.Test;
@@ -1,4 +1,4 @@
package net.minecraft.commands.exceptions; package com.mojang.brigadier.exceptions;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
@@ -1,4 +1,4 @@
package net.minecraft.commands.exceptions; package com.mojang.brigadier.exceptions;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import org.junit.Test; import org.junit.Test;
@@ -1,12 +1,12 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static net.minecraft.commands.builder.LiteralArgumentBuilder.literal; import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@@ -1,14 +1,14 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer; import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument; import static com.mojang.brigadier.builder.RequiredArgumentBuilder.argument;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@@ -1,13 +1,13 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import net.minecraft.commands.Command; import com.mojang.brigadier.Command;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import net.minecraft.commands.exceptions.CommandException; import com.mojang.brigadier.exceptions.CommandException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static net.minecraft.commands.builder.LiteralArgumentBuilder.literal; import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@@ -1,11 +1,11 @@
package net.minecraft.commands.tree; package com.mojang.brigadier.tree;
import com.google.common.testing.EqualsTester; import com.google.common.testing.EqualsTester;
import net.minecraft.commands.context.CommandContextBuilder; import com.mojang.brigadier.context.CommandContextBuilder;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static net.minecraft.commands.builder.LiteralArgumentBuilder.literal; import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;