Java Code Examples for com.mojang.brigadier.arguments.IntegerArgumentType#integer()

The following examples show how to use com.mojang.brigadier.arguments.IntegerArgumentType#integer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntegerArgument.java    From 1.13-Command-API with Apache License 2.0 5 votes vote down vote up
/**
 * An integer argument with a minimum and maximum value
 * @param min The minimum value this argument can take (inclusive)
 * @param max The maximum value this argument can take (inclusive)
 */
public IntegerArgument(int min, int max) {
	super(IntegerArgumentType.integer(min, max));
	if(max < min) {
		throw new InvalidRangeException();
	}
}
 
Example 2
Source File: IntegerArgumentPropertySerializer.java    From Velocity with MIT License 5 votes vote down vote up
@Override
public IntegerArgumentType deserialize(ByteBuf buf) {
  byte flags = buf.readByte();
  int minimum = (flags & HAS_MINIMUM) != 0 ? buf.readInt() : Integer.MIN_VALUE;
  int maximum = (flags & HAS_MAXIMUM) != 0 ? buf.readInt() : Integer.MAX_VALUE;
  return IntegerArgumentType.integer(minimum, maximum);
}
 
Example 3
Source File: IntegerArgument.java    From 1.13-Command-API with Apache License 2.0 4 votes vote down vote up
/**
 * An integer argument
 */
public IntegerArgument() {
	super(IntegerArgumentType.integer());
}
 
Example 4
Source File: IntegerArgument.java    From 1.13-Command-API with Apache License 2.0 2 votes vote down vote up
/**
 * An integer argument with a minimum value
 * @param min The minimum value this argument can take (inclusive)
 */
public IntegerArgument(int min) {
	super(IntegerArgumentType.integer(min));
}