Skip to content

Commit

Permalink
These too and bump API to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PetteriM1 committed Oct 3, 2024
1 parent 89be986 commit c6302d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/Nukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Nukkit {

public final static Properties GIT_INFO = getGitInfo();
public final static String VERSION = getVersion();
public final static String API_VERSION = "1.0.22";
public final static String API_VERSION = "1.1.0";
public final static String PATH = System.getProperty("user.dir") + '/';
public final static String DATA_PATH = System.getProperty("user.dir") + '/';
public final static String PLUGIN_PATH = DATA_PATH + "plugins";
Expand Down
39 changes: 19 additions & 20 deletions src/main/java/cn/nukkit/command/data/CommandParameter.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
package cn.nukkit.command.data;


import java.util.ArrayList;
import java.util.Arrays;

public class CommandParameter {

public final static String ARG_TYPE_STRING = "string";
public final static String ARG_TYPE_STRING_ENUM = "stringenum";
public final static String ARG_TYPE_BOOL = "bool";
public final static String ARG_TYPE_TARGET = "target";
public final static String ARG_TYPE_PLAYER = "target";
public final static String ARG_TYPE_BLOCK_POS = "blockpos";
public final static String ARG_TYPE_RAW_TEXT = "rawtext";
public final static String ARG_TYPE_INT = "int";

public static final String ENUM_TYPE_ITEM_LIST = "Item";
public static final String ENUM_TYPE_BLOCK_LIST = "Block";
public static final String ENUM_TYPE_COMMAND_LIST = "commandName";
public static final String ENUM_TYPE_ENCHANTMENT_LIST = "enchantmentType";
public static final String ENUM_TYPE_ENTITY_LIST = "entityType";
public static final String ENUM_TYPE_EFFECT_LIST = "effectType";
public static final String ENUM_TYPE_PARTICLE_LIST = "particleType";

public String name;
public CommandParamType type;
public boolean optional;
Expand All @@ -39,6 +20,10 @@ public CommandParameter(String name, String type, boolean optional) {
this(name, fromString(type), optional);
}

/**
* @deprecated use {@link #newType(String, boolean, CommandParamType)} instead
*/
@Deprecated
public CommandParameter(String name, CommandParamType type, boolean optional) {
this.name = name;
this.type = type;
Expand All @@ -61,26 +46,40 @@ public CommandParameter(String name) {
this(name, false);
}

/**
* @deprecated use {@link #newEnum(String, boolean, String)} instead
*/
@Deprecated
public CommandParameter(String name, boolean optional, String enumType) {
this.name = name;
this.type = CommandParamType.RAWTEXT;
this.optional = optional;
this.enumData = new CommandEnum(enumType, new ArrayList<>());
}

/**
* @deprecated use {@link #newEnum(String, boolean, String[])} instead
*/
@Deprecated
public CommandParameter(String name, boolean optional, String[] enumValues) {
this.name = name;
this.type = CommandParamType.RAWTEXT;
this.optional = optional;
this.enumData = new CommandEnum(name + "Enums", Arrays.asList(enumValues));
this.enumData = new CommandEnum(name + "Enums", enumValues);
}

/**
* @deprecated use {@link #newEnum(String, String)} instead
*/
@Deprecated
public CommandParameter(String name, String enumType) {
this(name, false, enumType);
}

/**
* @deprecated use {@link #newEnum(String, String[])} instead
*/
@Deprecated
public CommandParameter(String name, String[] enumValues) {
this(name, false, enumValues);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/command/defaults/GiveCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public GiveCommand(String name) {
this.commandParameters.clear();
this.commandParameters.put("default", new CommandParameter[]{
CommandParameter.newType("player", CommandParamType.TARGET),
new CommandParameter("itemName", false, CommandParameter.ENUM_TYPE_ITEM_LIST),
new CommandParameter("itemName", false, "Item"),
CommandParameter.newType("amount", true, CommandParamType.INT),
CommandParameter.newType("tags", true, CommandParamType.RAWTEXT)
});
Expand Down

0 comments on commit c6302d7

Please sign in to comment.